Commit d01f930e authored by 皮倩雯's avatar 皮倩雯

fix: '修改三维配置,地图配置界面留白样式'

parent 39a277af
Pipeline #43225 skipped with stages
...@@ -228,7 +228,7 @@ const TileData = props => { ...@@ -228,7 +228,7 @@ const TileData = props => {
dataSource={tileData} dataSource={tileData}
bordered bordered
rowKey="type" rowKey="type"
scroll={{ y: 400 }} scroll={{ y: 600 }}
pagination={{ pagination={{
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`, showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
}} }}
......
...@@ -190,7 +190,7 @@ const VectorData = props => { ...@@ -190,7 +190,7 @@ const VectorData = props => {
dataSource={tileData} dataSource={tileData}
bordered bordered
rowKey="id" rowKey="id"
scroll={{ y: 400 }} scroll={{ y: 600 }}
pagination={{ pagination={{
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`, showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
}} }}
......
import { Button,Spin } from 'antd'; /* eslint-disable indent */
import { Button, Spin } from 'antd';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from '../dimensionsConfig.less' import styles from '../dimensionsConfig.less';
import { import { GetSchemaInfoList } from '@/services/webConfig/api';
GetSchemaInfoList import AddModal from './AddModal';
} from '@/services/webConfig/api'; import Cards from './components/card';
import AddModal from './AddModal'
import Cards from './components/card'
const VectorData = props => { const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示 const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [tileData, setTileData] = useState([]); // 页面初始化数据 const [tileData, setTileData] = useState([]); // 页面初始化数据
const [visible, setVisible] = useState(false); // 弹窗 const [visible, setVisible] = useState(false); // 弹窗
const [flag, setFlag] = useState(0); // 状态更新 const [flag, setFlag] = useState(0); // 状态更新
const [type, setType] = useState(''); // 弹窗类型 const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({}); const [formObj, setFormObj] = useState({});
const onSubmit = prop => { const onSubmit = prop => {
setVisible(false); setVisible(false);
setFlag(flag + 1) setFlag(flag + 1);
};
const onDeletebaseMap = value => {
setFlag(flag + 1);
}; };
const onDeletebaseMap = (value) => {
setFlag(flag + 1)
}
const handleAdd = () => { const handleAdd = () => {
setType('schemeAdd'); setType('schemeAdd');
setVisible(true); setVisible(true);
} };
useEffect(() => { useEffect(() => {
renderTile(); renderTile();
}, [flag]); }, [flag]);
// 获取瓦片数据配置数据 // 获取瓦片数据配置数据
const renderTile = () => { const renderTile = () => {
setTreeLoading(true); setTreeLoading(true);
GetSchemaInfoList().then( GetSchemaInfoList().then(res => {
res => { if (res.msg === 'Ok') {
if (res.msg ==='Ok') {
setTreeLoading(false); setTreeLoading(false);
setTileData(res.data); setTileData(res.data);
} else { } else {
setTreeLoading(false); setTreeLoading(false);
}
} }
) });
}; };
return ( return (
<> <>
<Spin tip="loading..." spinning={treeLoading}> <Spin tip="loading..." spinning={treeLoading}>
<div style={{ width: 'calc(100vw - 265px)' }}> <div style={{ height: '780px', overflow: 'scroll' }}>
<div className={styles.tileBtn}> <div className={styles.tileBtn}>
<Button type="primary" onClick={() => { <Button
type="primary"
onClick={() => {
handleAdd(); handleAdd();
}} > }}
>
新增 新增
</Button> </Button>
</div> </div>
<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' }}> return (
<Cards item={item} deletebaseMaps={onDeletebaseMap} ></Cards> <div
className={styles.cardItem}
key={index}
span={5}
offset={2}
style={{ marginBottom: '1rem' }}
>
<Cards item={item} deletebaseMaps={onDeletebaseMap} />
</div>
);
})
: ''}
</div> </div>
}) : ''}
</div >
<AddModal <AddModal
visible={visible} visible={visible}
onCancel={() => setVisible(false)} onCancel={() => setVisible(false)}
...@@ -73,6 +80,6 @@ const VectorData = props => { ...@@ -73,6 +80,6 @@ const VectorData = props => {
</div> </div>
</Spin> </Spin>
</> </>
) );
} };
export default VectorData export default VectorData;
\ No newline at end of file
import { Space, Table, Button, Popconfirm, notification, Divider, Checkbox, Spin } from 'antd'; import { Space, Table, Button, Popconfirm, notification, Divider, Checkbox, Spin } from 'antd';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from '../dimensionsConfig.less' import styles from '../dimensionsConfig.less';
import VisibleRoleModal from '@/pages/platformCenter/messageManage/projectManage/components/RolseSelect/VisibleRoleModal' import VisibleRoleModal from '@/pages/platformCenter/messageManage/projectManage/components/RolseSelect/VisibleRoleModal';
import { PlusOutlined } from '@ant-design/icons';
import { import {
PlusOutlined deleteConfig,
} from '@ant-design/icons'; SettingRoleWebSchema,
import { SetServiceConfig,
deleteConfig, SettingRoleWebSchema, SetServiceConfig,DeleteWebSchema,GetWebSchemaList,GetSchemaInfoList,IsActionWebSchema DeleteWebSchema,
GetWebSchemaList,
GetSchemaInfoList,
IsActionWebSchema,
} from '@/services/webConfig/api'; } from '@/services/webConfig/api';
import { import { UserAddOutlined } from '@ant-design/icons';
UserAddOutlined import AddModal from './AddModal';
} from '@ant-design/icons';
import AddModal from './AddModal'
const VectorData = props => { const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示 const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [schemename, setSchemename] = useState([]); const [schemename, setSchemename] = useState([]);
const [record, setRecord] = useState({}); //选中关联角色的方案名 const [record, setRecord] = useState({}); //选中关联角色的方案名
const [webCurrent, setWebCurrent] = useState(0); // web列表下标 const [webCurrent, setWebCurrent] = useState(0); // web列表下标
...@@ -25,7 +27,7 @@ const VectorData = props => { ...@@ -25,7 +27,7 @@ const VectorData = props => {
const [handStatus, setHandStatus] = useState([]); // 更新状态 const [handStatus, setHandStatus] = useState([]); // 更新状态
const [webStatus, setWebStatus] = useState([]); // 更新状态 const [webStatus, setWebStatus] = useState([]); // 更新状态
const [type, setType] = useState(''); // 弹窗类型 const [type, setType] = useState(''); // 弹窗类型
const [checkLoading, setCheckLoading] = useState(false) const [checkLoading, setCheckLoading] = useState(false);
const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' }); const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' });
const columns = [ const columns = [
{ {
...@@ -45,11 +47,7 @@ const VectorData = props => { ...@@ -45,11 +47,7 @@ const VectorData = props => {
{ {
title: '方案名', title: '方案名',
align: 'center', align: 'center',
render: (text, record, index) => ( render: (text, record, index) => <Space>{record.scheme.schemename}</Space>,
<Space>
{record.scheme.schemename}
</Space>
),
}, },
{ {
title: '关联角色', title: '关联角色',
...@@ -58,7 +56,12 @@ const VectorData = props => { ...@@ -58,7 +56,12 @@ const VectorData = props => {
<Space> <Space>
<Space> <Space>
<div onClick={() => pickRole(record)} style={{ cursor: 'pointer' }}> <div onClick={() => pickRole(record)} style={{ cursor: 'pointer' }}>
<VisibleRoleModal onSubmit={onPushSubmit} title={"关联角色"} initValues ={record.roles!=null?record.roles.split(","):[]} operate={<UserAddOutlined />} /> <VisibleRoleModal
onSubmit={onPushSubmit}
title={'关联角色'}
initValues={record.roles != null ? record.roles.split(',') : []}
operate={<UserAddOutlined />}
/>
</div> </div>
</Space> </Space>
</Space> </Space>
...@@ -85,8 +88,7 @@ const VectorData = props => { ...@@ -85,8 +88,7 @@ const VectorData = props => {
</div> </div>
</Space> </Space>
), ),
} },
]; ];
// const columns1 = [ // const columns1 = [
// { // {
...@@ -148,96 +150,94 @@ const VectorData = props => { ...@@ -148,96 +150,94 @@ const VectorData = props => {
// ]; // ];
//获取选中的角色 //获取选中的角色
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 = {
schemaname: record.scheme.schemename, schemaname: record.scheme.schemename,
roles: id.join(',') roles: id.join(','),
} };
SettingRoleWebSchema(query).then(res => { SettingRoleWebSchema(query)
if (res.msg === "") { .then(res => {
prompt('success', '关联角色成功') if (res.msg === '') {
setFlag(flag + 1) prompt('success', '关联角色成功');
} setFlag(flag + 1);
else { } else {
prompt('fail', '关联角色失败') prompt('fail', '关联角色失败');
} }
}).catch(err=>{
prompt('fail', '网络请求失败')
}) })
.catch(err => {
} prompt('fail', '网络请求失败');
});
} }
};
//获取角色 //获取角色
const pickRole = (record) => { const pickRole = record => {
setRecord(record) setRecord(record);
} };
//设置web方案 //设置web方案
const onChangeCheck = (e, record, index) => { const onChangeCheck = (e, record, index) => {
setCheckLoading(true) setCheckLoading(true);
IsActionWebSchema({schemaname :record.scheme.schemename}).then(res=>{ IsActionWebSchema({ schemaname: record.scheme.schemename }).then(res => {
setCheckLoading(false) setCheckLoading(false);
if(res.msg===''){ if (res.msg === '') {
prompt('success', '设置成功') prompt('success', '设置成功');
setFlag(flag + 1) setFlag(flag + 1);
} } else {
else{ prompt('fail', res.msg);
prompt('fail', res.msg)
}
})
} }
});
};
//选择手持方案 //选择手持方案
const onChangeHand = (e, record, index) => { const onChangeHand = (e, record, index) => {
setCheckLoading(true) setCheckLoading(true);
const newLoadings = [...handStatus]; const newLoadings = [...handStatus];
newLoadings.map((item, loadIndex) => { newLoadings.map((item, loadIndex) => {
return loadIndex == index ? newLoadings[loadIndex] = !newLoadings[loadIndex] : newLoadings[loadIndex] = false return loadIndex == index
}) ? (newLoadings[loadIndex] = !newLoadings[loadIndex])
setHandStatus(newLoadings) : (newLoadings[loadIndex] = false);
});
setHandStatus(newLoadings);
let query = { let query = {
schemename: record['schemename'], schemename: record['schemename'],
terminalType: 'phone', terminalType: 'phone',
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify({ jsonCfg: JSON.stringify({
isDefault: newLoadings[index], isDefault: newLoadings[index],
}) }),
} };
if (!newLoadings[index]) { if (!newLoadings[index]) {
SetServiceConfig(query).then(res => { SetServiceConfig(query).then(res => {
setCheckLoading(false) setCheckLoading(false);
if (res.msg === "Ok") { if (res.msg === 'Ok') {
const changehandData = [...handData]; const changehandData = [...handData];
changehandData[index].isDefault = false changehandData[index].isDefault = false;
setHandData(changehandData) setHandData(changehandData);
prompt('success', '设置成功') prompt('success', '设置成功');
} else { } else {
prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message) prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message);
} }
});
}) return;
return
} }
var beforeDefault = handData.findIndex((item) => item['isDefault']); var beforeDefault = handData.findIndex(item => item['isDefault']);
SetServiceConfig({ SetServiceConfig({
schemename: record['schemename'], schemename: record['schemename'],
terminalType: 'phone', terminalType: 'phone',
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify({ jsonCfg: JSON.stringify({
isDefault: true, isDefault: true,
}) }),
}).then(res => { }).then(res => {
setCheckLoading(false) setCheckLoading(false);
if (res.msg === "Ok") { if (res.msg === 'Ok') {
const changehandData = [...handData]; const changehandData = [...handData];
changehandData[index].isDefault = true changehandData[index].isDefault = true;
setHandData(changehandData) setHandData(changehandData);
if (beforeDefault != -1) { if (beforeDefault != -1) {
SetServiceConfig({ SetServiceConfig({
schemename: changehandData[beforeDefault].schemename, schemename: changehandData[beforeDefault].schemename,
...@@ -245,22 +245,22 @@ const VectorData = props => { ...@@ -245,22 +245,22 @@ const VectorData = props => {
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify({ jsonCfg: JSON.stringify({
isDefault: false, isDefault: false,
}) }),
}).then(res => { }).then(res => {
setCheckLoading(false) setCheckLoading(false);
if (res.IsSuccess) { if (res.IsSuccess) {
const changehandData1 = [...handData]; const changehandData1 = [...handData];
changehandData1[beforeDefault].isDefault = false changehandData1[beforeDefault].isDefault = false;
setHandData(changehandData1) setHandData(changehandData1);
prompt('success', '设置成功') prompt('success', '设置成功');
return; return;
} }
prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message) prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message);
}) });
} }
} }
}) });
} };
const prompt = (type, content) => { const prompt = (type, content) => {
if (type == 'success') { if (type == 'success') {
notification.success({ notification.success({
...@@ -268,78 +268,71 @@ const VectorData = props => { ...@@ -268,78 +268,71 @@ const VectorData = props => {
duration: 3, duration: 3,
description: content, description: content,
}); });
} } else {
else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: content, description: content,
}); });
} }
} };
const onSubmit = prop => { const onSubmit = prop => {
setVisible(false); setVisible(false);
setFlag(flag + 1) setFlag(flag + 1);
}; };
//删除web配置方案 //删除web配置方案
const delWebConfirm = (record) => { const delWebConfirm = record => {
DeleteWebSchema( record.scheme.schemename).then(res => { DeleteWebSchema(record.scheme.schemename).then(res => {
if (res.msg === "") { if (res.msg === '') {
prompt('success', '删除成功') prompt('success', '删除成功');
setFlag(flag + 1) setFlag(flag + 1);
} else { } else {
prompt('fail', '删除失败') prompt('fail', '删除失败');
};
})
} }
});
};
//删除手持配置方案 //删除手持配置方案
const delhandConfirm = (record) => { const delhandConfirm = record => {
deleteConfig({ deleteConfig({
schemename: record['schemename'], schemename: record['schemename'],
terminalType: 'phone', terminalType: 'phone',
isBaseMap: false isBaseMap: false,
}).then(res => { }).then(res => {
if (res.msg === "Ok") { if (res.msg === 'Ok') {
prompt('success', '删除成功') prompt('success', '删除成功');
setFlag(flag + 1) setFlag(flag + 1);
} else { } else {
prompt('fail', '删除失败') prompt('fail', '删除失败');
};
})
} }
});
};
//添加方案 //添加方案
const addType = (type) => { const addType = type => {
setType(type); setType(type);
let listData = [] let listData = [];
type == 'add' ? listData = webData : listData = handData type == 'add' ? (listData = webData) : (listData = handData);
let webSchemenameArr = [], schemeArr = [] let webSchemenameArr = [],
schemeArr = [];
setTreeLoading(true); setTreeLoading(true);
GetSchemaInfoList().then( GetSchemaInfoList().then(res => {
res => {
if (res.data && res.data.length) { if (res.data && res.data.length) {
setTreeLoading(false); setTreeLoading(false);
listData.map(item => { listData.map(item => {
webSchemenameArr.push(item.scheme.schemename) webSchemenameArr.push(item.scheme.schemename);
}) });
res.data.map(item => { res.data.map(item => {
if (!webSchemenameArr.includes(item.schemename)) if (!webSchemenameArr.includes(item.schemename)) schemeArr.push(item.schemename);
schemeArr.push(item.schemename) });
}) setSchemename(schemeArr);
setSchemename(schemeArr)
if (schemeArr.length) { if (schemeArr.length) {
setVisible(true); setVisible(true);
} } else {
else {
notification.warning({ notification.warning({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: '请先配置方案', description: '请先配置方案',
}); });
} }
} else { } else {
setTreeLoading(false); setTreeLoading(false);
notification.warning({ notification.warning({
...@@ -348,23 +341,23 @@ const VectorData = props => { ...@@ -348,23 +341,23 @@ const VectorData = props => {
description: '请先配置方案', description: '请先配置方案',
}); });
} }
} });
) };
}
useEffect(() => { useEffect(() => {
renderTile(); renderTile();
}, [flag]); }, [flag]);
// 获取瓦片数据配置数据 // 获取瓦片数据配置数据
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 = GetWebSchemaList() var webSchemeQueryRequest = GetWebSchemaList();
Promise.all([ webSchemeQueryRequest]).then(res => { Promise.all([webSchemeQueryRequest])
.then(res => {
// if (res[0].msg==="Ok" && res[0].data.phone) { // if (res[0].msg==="Ok" && res[0].data.phone) {
// let arr = [] // let arr = []
// res[0].data.phone.optionalLayer.layers.map((item, index) => { // res[0].data.phone.optionalLayer.layers.map((item, index) => {
...@@ -381,54 +374,58 @@ const VectorData = props => { ...@@ -381,54 +374,58 @@ const VectorData = props => {
// setHandStatus(arr) // setHandStatus(arr)
// } // }
if (res[0].msg==="Ok" && res[0].data) { if (res[0].msg === 'Ok' && res[0].data) {
let arr = [] let arr = [];
res[0].data.map((item, index) => { res[0].data.map((item, index) => {
if (item.isDefault) { if (item.isDefault) {
arr.push(true) arr.push(true);
} else { } else {
arr.push(false) arr.push(false);
} }
item.isStatus = 'web' item.isStatus = 'web';
return item return item;
}) });
setWebData(res[0].data) setWebData(res[0].data);
setWebStatus(arr) setWebStatus(arr);
} }
setCheckLoading(false) setCheckLoading(false);
}).catch(e=>{
setCheckLoading(false)
}) })
.catch(e => {
setCheckLoading(false);
});
}; };
return ( return (
<> <>
<Spin tip="loading..." spinning={checkLoading}> <Spin tip="loading..." spinning={checkLoading}>
<div className={styles.solutionConfig}> <div className={styles.solutionConfig}>
<div > <div>
<Divider orientation="left"><div className={styles.divider}> Web <PlusOutlined <Divider orientation="left">
onClick={() => { addType('add') }} <div className={styles.divider}>
className={styles.dividerIcon} /></div></Divider> {' '}
Web{' '}
<PlusOutlined
onClick={() => {
addType('add');
}}
className={styles.dividerIcon}
/>
</div>
</Divider>
<Table <Table
columns={columns} columns={columns}
dataSource={webData} dataSource={webData}
bordered bordered
pagination={{ pagination={{
showTotal: (total, range) => showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
defaultPageSize: 8, defaultPageSize: 8,
onChange: (value) => { onChange: value => {
setWebCurrent(value - 1) setWebCurrent(value - 1);
} },
}} }}
rowKey={(record, index) => record.scheme.schemename} rowKey={(record, index) => record.scheme.schemename}
scroll={{ y: 400 }} scroll={{ y: 600 }}
> />
</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') }}
...@@ -461,6 +458,6 @@ const VectorData = props => { ...@@ -461,6 +458,6 @@ const VectorData = props => {
listData={schemename} listData={schemename}
/> />
</> </>
) );
} };
export default VectorData export default VectorData;
\ No newline at end of file
import { Space, Table, Button, Popconfirm, notification, Spin } from 'antd'; import { Space, Table, Button, Popconfirm, notification, Spin } from 'antd';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from '../SchemeConfig.less' import styles from '../SchemeConfig.less';
import { import { GettMaplayer, deleteConfig } from '@/services/webConfig/api';
GettMaplayer, import AddModal from './AddModal';
deleteConfig
} from '@/services/webConfig/api';
import AddModal from './AddModal'
const TileData = props => { const TileData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示 const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [tileData, setTileData] = useState([]); // table表格数据 const [tileData, setTileData] = useState([]); // table表格数据
const [visible, setVisible] = useState(false); // 弹窗 const [visible, setVisible] = useState(false); // 弹窗
const [type, setType] = useState(''); // 弹窗类型 const [type, setType] = useState(''); // 弹窗类型
...@@ -19,25 +16,25 @@ const TileData = props => { ...@@ -19,25 +16,25 @@ const TileData = props => {
title: '服务名', title: '服务名',
dataIndex: 'servicename', dataIndex: 'servicename',
key: 'servicename', key: 'servicename',
align: 'center' align: 'center',
}, },
{ {
title: '标签', title: '标签',
dataIndex: 'label', dataIndex: 'label',
key: 'label', key: 'label',
align: 'center' align: 'center',
}, },
{ {
title: '类型', title: '类型',
dataIndex: 'type', dataIndex: 'type',
key: 'type', key: 'type',
align: 'center' align: 'center',
}, },
{ {
title: '透明度', title: '透明度',
dataIndex: 'alpha', dataIndex: 'alpha',
key: 'alpha', key: 'alpha',
align: 'center' align: 'center',
}, },
{ {
title: '编辑', title: '编辑',
...@@ -70,27 +67,27 @@ const TileData = props => { ...@@ -70,27 +67,27 @@ const TileData = props => {
</Space> </Space>
), ),
}, },
]; ];
const changebaseMap = (record) => { const changebaseMap = record => {
setType('edit'); setType('edit');
setFormObj(record); setFormObj(record);
setVisible(true); setVisible(true);
} };
const onSubmit = prop => { const onSubmit = prop => {
setVisible(false); setVisible(false);
setFlag(flag + 1) setFlag(flag + 1);
}; };
const delConfirm = (record) => { const delConfirm = record => {
const { servicename = '' } = record; const { servicename = '' } = record;
setTreeLoading(true); setTreeLoading(true);
deleteConfig({ deleteConfig({
servicename: servicename, servicename: servicename,
terminalType: 'base', terminalType: 'base',
isBaseMap: true isBaseMap: true,
}).then(res => { })
setFlag(flag + 1) .then(res => {
setFlag(flag + 1);
setTreeLoading(false); setTreeLoading(false);
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
// form.resetFields(); // form.resetFields();
...@@ -107,47 +104,45 @@ const TileData = props => { ...@@ -107,47 +104,45 @@ const TileData = props => {
description: res.message || '删除失败', description: res.message || '删除失败',
}); });
} }
}).catch(err => {
setFlag(flag + 1)
setTreeLoading(false);
}) })
} .catch(err => {
setFlag(flag + 1);
setTreeLoading(false);
});
};
const handleAdd = () => { const handleAdd = () => {
if (baseMap.length) { if (baseMap.length) {
setType('add'); setType('add');
setVisible(true); setVisible(true);
} } else {
else {
notification.warning({ notification.warning({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: '地图类型已都存在,可编辑修改', description: '地图类型已都存在,可编辑修改',
}); });
} }
};
}
useEffect(() => { useEffect(() => {
renderTile(); renderTile();
}, [flag]); }, [flag]);
// 获取瓦片数据配置数据 // 获取瓦片数据配置数据
const renderTile = () => { const renderTile = () => {
setTreeLoading(true); setTreeLoading(true);
const baseMapData = ['高德地形', '高德影像', '天地图地形', '天地图影像'] const baseMapData = ['高德地形', '高德影像', '天地图地形', '天地图影像'];
GettMaplayer({ GettMaplayer({
terminalType: 'base', terminalType: 'base',
isBaseMap: true isBaseMap: true,
}).then( }).then(res => {
res => { if (res.msg === 'Ok') {
if (res.msg === "Ok") {
setTreeLoading(false); setTreeLoading(false);
setTileData(res.data.general.baseMap.layers); setTileData(res.data.general.baseMap.layers);
res.data.general.baseMap.layers.map((item) => { res.data.general.baseMap.layers.map(item => {
let index = baseMapData.indexOf(item.servicename); let index = baseMapData.indexOf(item.servicename);
if (index != -1) { if (index != -1) {
baseMapData.splice(index, 1); baseMapData.splice(index, 1);
} }
}) });
setBaseMap(baseMapData) setBaseMap(baseMapData);
} else { } else {
setTreeLoading(false); setTreeLoading(false);
notification.error({ notification.error({
...@@ -155,17 +150,19 @@ const TileData = props => { ...@@ -155,17 +150,19 @@ const TileData = props => {
description: res.message, description: res.message,
}); });
} }
} });
)
}; };
return ( return (
<> <>
<Spin tip="loading..." spinning={treeLoading}> <Spin tip="loading..." spinning={treeLoading}>
<div className={styles.tileBtn}> <div className={styles.tileBtn}>
<Button type="primary" onClick={() => { <Button
type="primary"
onClick={() => {
handleAdd(); handleAdd();
}} > }}
>
新增 新增
</Button> </Button>
</div> </div>
...@@ -174,14 +171,11 @@ const TileData = props => { ...@@ -174,14 +171,11 @@ const TileData = props => {
dataSource={tileData} dataSource={tileData}
bordered bordered
rowKey="type" rowKey="type"
scroll={{ y: 400 }} scroll={{ y: 600 }}
pagination={{ pagination={{
showTotal: (total, range) => showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
`第${range[0]}-${range[1]} 条/共 ${total} 条`
}} }}
> />
</Table>
<AddModal <AddModal
visible={visible} visible={visible}
onCancel={() => setVisible(false)} onCancel={() => setVisible(false)}
...@@ -192,6 +186,6 @@ const TileData = props => { ...@@ -192,6 +186,6 @@ const TileData = props => {
/> />
</Spin> </Spin>
</> </>
) );
} };
export default TileData export default TileData;
\ No newline at end of file
...@@ -215,7 +215,7 @@ const VectorData = props => { ...@@ -215,7 +215,7 @@ const VectorData = props => {
dataSource={tileData} dataSource={tileData}
bordered bordered
rowKey="CreateTime" rowKey="CreateTime"
scroll={{ y: 400 }} scroll={{ y: 600 }}
pagination={{ pagination={{
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`, showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
}} }}
......
import { Button,Spin } from 'antd'; /* eslint-disable indent */
import { Button, Spin } from 'antd';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from '../SchemeConfig.less' import styles from '../SchemeConfig.less';
import { import { GetMaplayerByTerminalType } from '@/services/webConfig/api';
GetMaplayerByTerminalType import AddModal from './AddModal';
} from '@/services/webConfig/api'; import Cards from './components/card';
import AddModal from './AddModal'
import Cards from './components/card'
const VectorData = props => { const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示 const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [tileData, setTileData] = useState([]); // 页面初始化数据 const [tileData, setTileData] = useState([]); // 页面初始化数据
const [visible, setVisible] = useState(false); // 弹窗 const [visible, setVisible] = useState(false); // 弹窗
const [flag, setFlag] = useState(0); // 状态更新 const [flag, setFlag] = useState(0); // 状态更新
const [type, setType] = useState(''); // 弹窗类型 const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({}); const [formObj, setFormObj] = useState({});
const onSubmit = prop => { const onSubmit = prop => {
setVisible(false); setVisible(false);
setFlag(flag + 1) setFlag(flag + 1);
};
const onDeletebaseMap = value => {
setFlag(flag + 1);
}; };
const onDeletebaseMap = (value) => {
setFlag(flag + 1)
}
const handleAdd = () => { const handleAdd = () => {
setType('schemeAdd'); setType('schemeAdd');
setVisible(true); setVisible(true);
} };
useEffect(() => { useEffect(() => {
renderTile(); renderTile();
}, [flag]); }, [flag]);
...@@ -34,39 +32,48 @@ const VectorData = props => { ...@@ -34,39 +32,48 @@ const VectorData = props => {
setTreeLoading(true); setTreeLoading(true);
GetMaplayerByTerminalType({ GetMaplayerByTerminalType({
terminalType: 'scheme', terminalType: 'scheme',
isBaseMap: false isBaseMap: false,
}).then( }).then(res => {
res => { console.log('res', res);
console.log('res',res); if (res.msg === 'Ok') {
if (res.msg ==='Ok') {
setTreeLoading(false); setTreeLoading(false);
setTileData(res.data.scheme.optionalLayer.layers); setTileData(res.data.scheme.optionalLayer.layers);
} else { } else {
setTreeLoading(false); setTreeLoading(false);
}
} }
) });
}; };
return ( return (
<> <>
<Spin tip="loading..." spinning={treeLoading}> <Spin tip="loading..." spinning={treeLoading}>
<div style={{ width: 'calc(100vw - 265px)' }}> <div style={{ height: '780px', overflow: 'scroll' }}>
<div className={styles.tileBtn}> <div className={styles.tileBtn}>
<Button type="primary" onClick={() => { <Button
type="primary"
onClick={() => {
handleAdd(); handleAdd();
}} > }}
>
新增 新增
</Button> </Button>
</div> </div>
<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' }}> return (
<Cards item={item} deletebaseMaps={onDeletebaseMap} ></Cards> <div
className={styles.cardItem}
key={index}
span={5}
offset={2}
style={{ marginBottom: '1rem' }}
>
<Cards item={item} deletebaseMaps={onDeletebaseMap} />
</div>
);
})
: ''}
</div> </div>
}) : ''}
</div >
<AddModal <AddModal
visible={visible} visible={visible}
onCancel={() => setVisible(false)} onCancel={() => setVisible(false)}
...@@ -77,6 +84,6 @@ const VectorData = props => { ...@@ -77,6 +84,6 @@ const VectorData = props => {
</div> </div>
</Spin> </Spin>
</> </>
) );
} };
export default VectorData export default VectorData;
\ No newline at end of file
import { Space, Table, Button, Popconfirm, notification, Divider, Checkbox, Spin } from 'antd'; import { Space, Table, Button, Popconfirm, notification, Divider, Checkbox, Spin } from 'antd';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from '../SchemeConfig.less' import styles from '../SchemeConfig.less';
import VisibleRoleModal from '@/pages/platformCenter/messageManage/projectManage/components/RolseSelect/VisibleRoleModal' import VisibleRoleModal from '@/pages/platformCenter/messageManage/projectManage/components/RolseSelect/VisibleRoleModal';
import { PlusOutlined } from '@ant-design/icons';
import { import {
PlusOutlined deleteConfig,
} from '@ant-design/icons'; setServiceType,
import { SetServiceConfig,
deleteConfig, setServiceType, SetServiceConfig, GetMaplayerByTerminalType GetMaplayerByTerminalType,
} from '@/services/webConfig/api'; } from '@/services/webConfig/api';
import { import { UserAddOutlined } from '@ant-design/icons';
UserAddOutlined import AddModal from './AddModal';
} from '@ant-design/icons';
import AddModal from './AddModal'
const VectorData = props => { const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示 const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [schemename, setSchemename] = useState([]); const [schemename, setSchemename] = useState([]);
const [record, setRecord] = useState({}); //选中关联角色的方案名 const [record, setRecord] = useState({}); //选中关联角色的方案名
const [webCurrent, setWebCurrent] = useState(0); // web列表下标 const [webCurrent, setWebCurrent] = useState(0); // web列表下标
...@@ -25,7 +24,7 @@ const VectorData = props => { ...@@ -25,7 +24,7 @@ const VectorData = props => {
const [handStatus, setHandStatus] = useState([]); // 更新状态 const [handStatus, setHandStatus] = useState([]); // 更新状态
const [webStatus, setWebStatus] = useState([]); // 更新状态 const [webStatus, setWebStatus] = useState([]); // 更新状态
const [type, setType] = useState(''); // 弹窗类型 const [type, setType] = useState(''); // 弹窗类型
const [checkLoading, setCheckLoading] = useState(false) const [checkLoading, setCheckLoading] = useState(false);
const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' }); const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' });
const columns = [ const columns = [
{ {
...@@ -47,7 +46,7 @@ const VectorData = props => { ...@@ -47,7 +46,7 @@ const VectorData = props => {
title: '方案名', title: '方案名',
dataIndex: 'schemename', dataIndex: 'schemename',
key: 'schemename', key: 'schemename',
align: 'center' align: 'center',
}, },
{ {
title: '关联角色', title: '关联角色',
...@@ -57,7 +56,12 @@ const VectorData = props => { ...@@ -57,7 +56,12 @@ const VectorData = props => {
<Space> <Space>
<Space> <Space>
<div onClick={() => pickRole(record)} style={{ cursor: 'pointer' }}> <div onClick={() => pickRole(record)} style={{ cursor: 'pointer' }}>
<VisibleRoleModal onSubmit={onPushSubmit} title={"关联角色"} initValues={record.roles != null ? record.roles.split(",") : []} operate={<UserAddOutlined />} /> <VisibleRoleModal
onSubmit={onPushSubmit}
title={'关联角色'}
initValues={record.roles != null ? record.roles.split(',') : []}
operate={<UserAddOutlined />}
/>
</div> </div>
</Space> </Space>
</Space> </Space>
...@@ -85,8 +89,7 @@ const VectorData = props => { ...@@ -85,8 +89,7 @@ const VectorData = props => {
</div> </div>
</Space> </Space>
), ),
} },
]; ];
const columns1 = [ const columns1 = [
{ {
...@@ -108,7 +111,7 @@ const VectorData = props => { ...@@ -108,7 +111,7 @@ const VectorData = props => {
title: '方案名', title: '方案名',
dataIndex: 'schemename', dataIndex: 'schemename',
key: 'schemename', key: 'schemename',
align: 'center' align: 'center',
}, },
{ {
title: '关联角色', title: '关联角色',
...@@ -117,7 +120,13 @@ const VectorData = props => { ...@@ -117,7 +120,13 @@ const VectorData = props => {
render: (text, record, index) => ( render: (text, record, index) => (
<Space> <Space>
<div onClick={() => pickRole(record)} style={{ cursor: 'pointer' }}> <div onClick={() => pickRole(record)} style={{ cursor: 'pointer' }}>
<VisibleRoleModal onSubmit={onPushSubmit} selectValue={[]} title={"关联角色"} initValues={record.roles != null ? record.roles.split(",") : []} operate={<UserAddOutlined />} /> <VisibleRoleModal
onSubmit={onPushSubmit}
selectValue={[]}
title={'关联角色'}
initValues={record.roles != null ? record.roles.split(',') : []}
operate={<UserAddOutlined />}
/>
</div> </div>
</Space> </Space>
), ),
...@@ -144,146 +153,146 @@ const VectorData = props => { ...@@ -144,146 +153,146 @@ const VectorData = props => {
</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, schemename: record.schemename,
terminalType: record.isStatus, terminalType: record.isStatus,
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify({ jsonCfg: JSON.stringify({
roles: id.join(',') roles: id.join(','),
}) }),
} };
SetServiceConfig(query).then(res => { SetServiceConfig(query)
if (res.msg === "Ok") { .then(res => {
prompt('success', '关联角色成功') if (res.msg === 'Ok') {
setFlag(flag + 1) prompt('success', '关联角色成功');
} setFlag(flag + 1);
else { } else {
prompt('fail', '关联角色失败') prompt('fail', '关联角色失败');
} }
}).catch(err => {
prompt('fail', '网络请求失败')
}) })
.catch(err => {
} prompt('fail', '网络请求失败');
});
} }
};
//获取角色 //获取角色
const pickRole = (record) => { const pickRole = record => {
console.log('recird', record); console.log('recird', record);
setRecord(record) setRecord(record);
} };
//设置web方案 //设置web方案
const onChangeCheck = (e, record, index) => { const onChangeCheck = (e, record, index) => {
setCheckLoading(true) setCheckLoading(true);
const newLoadings = [...webStatus]; const newLoadings = [...webStatus];
newLoadings.map((item, loadIndex) => { newLoadings.map((item, loadIndex) => {
return loadIndex == index ? newLoadings[loadIndex] = !newLoadings[loadIndex] : newLoadings[loadIndex] = false return loadIndex == index
}) ? (newLoadings[loadIndex] = !newLoadings[loadIndex])
setWebStatus(newLoadings) : (newLoadings[loadIndex] = false);
});
setWebStatus(newLoadings);
let query = { let query = {
schemename: record['schemename'], schemename: record['schemename'],
type: 'dynamic' type: 'dynamic',
} };
if (!newLoadings[index]) { if (!newLoadings[index]) {
setServiceType(query).then(res => { setServiceType(query).then(res => {
setCheckLoading(false) setCheckLoading(false);
if (res.IsSuccess) { if (res.IsSuccess) {
const changehandData = [...webData]; const changehandData = [...webData];
changehandData[index].type = 'dynamic' changehandData[index].type = 'dynamic';
setWebData(changehandData) setWebData(changehandData);
prompt('success', '设置成功') prompt('success', '设置成功');
} else { } else {
prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message) prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message);
} }
});
}) return;
return
} }
var beforeDefault = webData.findIndex((item) => item['type'] == 'pipenet'); var beforeDefault = webData.findIndex(item => item['type'] == 'pipenet');
setServiceType({ setServiceType({
schemename: record['schemename'], schemename: record['schemename'],
type: 'pipenet' type: 'pipenet',
}).then(res => { }).then(res => {
setCheckLoading(false) setCheckLoading(false);
if (res.IsSuccess) { if (res.IsSuccess) {
const changehandData = [...webData]; const changehandData = [...webData];
changehandData[index].type = 'pipenet' changehandData[index].type = 'pipenet';
setWebData(changehandData) setWebData(changehandData);
if (beforeDefault != -1) { if (beforeDefault != -1) {
setServiceType({ setServiceType({
schemename: changehandData[beforeDefault].schemename, schemename: changehandData[beforeDefault].schemename,
type: 'dynamic' type: 'dynamic',
}).then(res => { }).then(res => {
setCheckLoading(false) setCheckLoading(false);
if (res.IsSuccess) { if (res.IsSuccess) {
const changehandData1 = [...webData]; const changehandData1 = [...webData];
changehandData1[beforeDefault].type = 'dynamic' changehandData1[beforeDefault].type = 'dynamic';
setWebData(changehandData1) setWebData(changehandData1);
prompt('success', '设置成功') prompt('success', '设置成功');
return; return;
} }
prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message) prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message);
}) });
} }
} }
}) });
} };
//选择手持方案 //选择手持方案
const onChangeHand = (e, record, index) => { const onChangeHand = (e, record, index) => {
setCheckLoading(true) setCheckLoading(true);
const newLoadings = [...handStatus]; const newLoadings = [...handStatus];
newLoadings.map((item, loadIndex) => { newLoadings.map((item, loadIndex) => {
return loadIndex == index ? newLoadings[loadIndex] = !newLoadings[loadIndex] : newLoadings[loadIndex] = false return loadIndex == index
}) ? (newLoadings[loadIndex] = !newLoadings[loadIndex])
setHandStatus(newLoadings) : (newLoadings[loadIndex] = false);
});
setHandStatus(newLoadings);
let query = { let query = {
schemename: record['schemename'], schemename: record['schemename'],
terminalType: 'phone', terminalType: 'phone',
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify({ jsonCfg: JSON.stringify({
isDefault: newLoadings[index], isDefault: newLoadings[index],
}) }),
} };
if (!newLoadings[index]) { if (!newLoadings[index]) {
SetServiceConfig(query).then(res => { SetServiceConfig(query).then(res => {
setCheckLoading(false) setCheckLoading(false);
if (res.msg === "Ok") { if (res.msg === 'Ok') {
const changehandData = [...handData]; const changehandData = [...handData];
changehandData[index].isDefault = false changehandData[index].isDefault = false;
setHandData(changehandData) setHandData(changehandData);
prompt('success', '设置成功') prompt('success', '设置成功');
} else { } else {
prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message) prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message);
} }
});
}) return;
return
} }
var beforeDefault = handData.findIndex((item) => item['isDefault']); var beforeDefault = handData.findIndex(item => item['isDefault']);
SetServiceConfig({ SetServiceConfig({
schemename: record['schemename'], schemename: record['schemename'],
terminalType: 'phone', terminalType: 'phone',
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify({ jsonCfg: JSON.stringify({
isDefault: true, isDefault: true,
}) }),
}).then(res => { }).then(res => {
setCheckLoading(false) setCheckLoading(false);
if (res.msg === "Ok") { if (res.msg === 'Ok') {
const changehandData = [...handData]; const changehandData = [...handData];
changehandData[index].isDefault = true changehandData[index].isDefault = true;
setHandData(changehandData) setHandData(changehandData);
if (beforeDefault != -1) { if (beforeDefault != -1) {
SetServiceConfig({ SetServiceConfig({
schemename: changehandData[beforeDefault].schemename, schemename: changehandData[beforeDefault].schemename,
...@@ -291,22 +300,22 @@ const VectorData = props => { ...@@ -291,22 +300,22 @@ const VectorData = props => {
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify({ jsonCfg: JSON.stringify({
isDefault: false, isDefault: false,
}) }),
}).then(res => { }).then(res => {
setCheckLoading(false) setCheckLoading(false);
if (res.IsSuccess) { if (res.IsSuccess) {
const changehandData1 = [...handData]; const changehandData1 = [...handData];
changehandData1[beforeDefault].isDefault = false changehandData1[beforeDefault].isDefault = false;
setHandData(changehandData1) setHandData(changehandData1);
prompt('success', '设置成功') prompt('success', '设置成功');
return; return;
} }
prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message) prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message);
}) });
}
} }
})
} }
});
};
const prompt = (type, content) => { const prompt = (type, content) => {
if (type == 'success') { if (type == 'success') {
notification.success({ notification.success({
...@@ -314,85 +323,78 @@ const VectorData = props => { ...@@ -314,85 +323,78 @@ const VectorData = props => {
duration: 3, duration: 3,
description: content, description: content,
}); });
} } else {
else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: content, description: content,
}); });
} }
} };
const onSubmit = prop => { const onSubmit = prop => {
setVisible(false); setVisible(false);
setFlag(flag + 1) setFlag(flag + 1);
}; };
//删除web配置方案 //删除web配置方案
const delWebConfirm = (record) => { const delWebConfirm = record => {
deleteConfig({ deleteConfig({
schemename: record['schemename'], schemename: record['schemename'],
terminalType: 'web', terminalType: 'web',
isBaseMap: false isBaseMap: false,
}).then(res => { }).then(res => {
if (res.msg === "Ok") { if (res.msg === 'Ok') {
prompt('success', '删除成功') prompt('success', '删除成功');
setFlag(flag + 1) setFlag(flag + 1);
} else { } else {
prompt('fail', '删除失败') prompt('fail', '删除失败');
};
})
} }
});
};
//删除手持配置方案 //删除手持配置方案
const delhandConfirm = (record) => { const delhandConfirm = record => {
deleteConfig({ deleteConfig({
schemename: record['schemename'], schemename: record['schemename'],
terminalType: 'phone', terminalType: 'phone',
isBaseMap: false isBaseMap: false,
}).then(res => { }).then(res => {
if (res.msg === "Ok") { if (res.msg === 'Ok') {
prompt('success', '删除成功') prompt('success', '删除成功');
setFlag(flag + 1) setFlag(flag + 1);
} else { } else {
prompt('fail', '删除失败') prompt('fail', '删除失败');
};
})
} }
});
};
//添加方案 //添加方案
const addType = (type) => { const addType = type => {
setType(type); setType(type);
let listData = [] let listData = [];
type == 'add' ? listData = webData : listData = handData type == 'add' ? (listData = webData) : (listData = handData);
let webSchemenameArr = [], schemeArr = [] let webSchemenameArr = [],
schemeArr = [];
setTreeLoading(true); setTreeLoading(true);
GetMaplayerByTerminalType({ GetMaplayerByTerminalType({
terminalType: 'scheme', terminalType: 'scheme',
isBaseMap: false isBaseMap: false,
}).then( }).then(res => {
res => {
if (res.data.scheme && res.data.scheme.optionalLayer.layers.length) { if (res.data.scheme && res.data.scheme.optionalLayer.layers.length) {
setTreeLoading(false); setTreeLoading(false);
listData.map(item => { listData.map(item => {
webSchemenameArr.push(item.schemename) webSchemenameArr.push(item.schemename);
}) });
res.data.scheme.optionalLayer.layers.map(item => { res.data.scheme.optionalLayer.layers.map(item => {
if (!webSchemenameArr.includes(item.schemename)) if (!webSchemenameArr.includes(item.schemename)) schemeArr.push(item.schemename);
schemeArr.push(item.schemename) });
}) setSchemename(schemeArr);
setSchemename(schemeArr)
if (schemeArr.length) { if (schemeArr.length) {
setVisible(true); setVisible(true);
} } else {
else {
notification.warning({ notification.warning({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: '请先配置方案', description: '请先配置方案',
}); });
} }
} else { } else {
setTreeLoading(false); setTreeLoading(false);
notification.warning({ notification.warning({
...@@ -401,112 +403,120 @@ const VectorData = props => { ...@@ -401,112 +403,120 @@ const VectorData = props => {
description: '请先配置方案', description: '请先配置方案',
}); });
} }
} });
) };
}
useEffect(() => { useEffect(() => {
renderTile(); renderTile();
}, [flag]); }, [flag]);
// 获取瓦片数据配置数据 // 获取瓦片数据配置数据
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 = GetMaplayerByTerminalType({
terminalType: 'web', terminalType: 'web',
isBaseMap: false isBaseMap: false,
}) });
Promise.all([schemeConfigQueryRequest, webSchemeQueryRequest]).then(res => { Promise.all([schemeConfigQueryRequest, webSchemeQueryRequest])
.then(res => {
console.log('res', res); console.log('res', res);
if (res[0].msg === "Ok" && res[0].data.phone) { if (res[0].msg === 'Ok' && res[0].data.phone) {
let arr = [] let arr = [];
res[0].data.phone.optionalLayer.layers.map((item, index) => { res[0].data.phone.optionalLayer.layers.map((item, index) => {
if (item.isDefault) { if (item.isDefault) {
arr.push(true) arr.push(true);
} else { } else {
arr.push(false) 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[1].msg === 'Ok' && res[1].data.web) {
let arr = [] let arr = [];
res[1].data.web.optionalLayer.layers.map((item, index) => { res[1].data.web.optionalLayer.layers.map((item, index) => {
if (item.type === "pipenet") { if (item.type === 'pipenet') {
arr.push(true) arr.push(true);
} else { } else {
arr.push(false) arr.push(false);
} }
item.isStatus = 'web' item.isStatus = 'web';
return item return item;
}) });
setWebData(res[1].data.web.optionalLayer.layers) setWebData(res[1].data.web.optionalLayer.layers);
setWebStatus(arr) setWebStatus(arr);
} }
setCheckLoading(false) setCheckLoading(false);
}).catch(e => {
setCheckLoading(false)
}) })
.catch(e => {
setCheckLoading(false);
});
}; };
return ( return (
<> <>
<Spin tip="loading..." spinning={checkLoading}> <Spin tip="loading..." spinning={checkLoading}>
<div className={styles.solutionConfig}> <div className={styles.solutionConfig}>
<div > <div>
<Divider orientation="left"><div className={styles.divider}> Web <PlusOutlined <Divider orientation="left">
onClick={() => { addType('add') }} <div className={styles.divider}>
className={styles.dividerIcon} /></div></Divider> {' '}
Web{' '}
<PlusOutlined
onClick={() => {
addType('add');
}}
className={styles.dividerIcon}
/>
</div>
</Divider>
<Table <Table
columns={columns} columns={columns}
dataSource={webData} dataSource={webData}
bordered bordered
pagination={{ pagination={{
showTotal: (total, range) => showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
defaultPageSize: 8, defaultPageSize: 8,
onChange: (value) => { onChange: value => {
setWebCurrent(value - 1) setWebCurrent(value - 1);
} },
}} }}
rowKey="schemename" rowKey="schemename"
scroll={{ y: 400 }} scroll={{ y: 400 }}
> />
</Table>
</div> </div>
<Divider orientation="left"><div className={styles.divider}>手持 <PlusOutlined <Divider orientation="left">
onClick={() => { addType('addHand') }} <div className={styles.divider}>
className={styles.dividerIcon} /></div> </Divider> 手持{' '}
<PlusOutlined
onClick={() => {
addType('addHand');
}}
className={styles.dividerIcon}
/>
</div>{' '}
</Divider>
<Table <Table
columns={columns1} columns={columns1}
dataSource={handData} dataSource={handData}
bordered bordered
rowKey="schemename" rowKey="schemename"
scroll={{ y: 400 }} scroll={{ y: 600 }}
pagination={{ pagination={{
showTotal: (total, range) => showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
defaultPageSize: 8, defaultPageSize: 8,
onChange: (value) => { onChange: value => {
setHandCurrent(value - 1) setHandCurrent(value - 1);
} },
}} }}
> />
</Table>
</div> </div>
</Spin> </Spin>
<AddModal <AddModal
...@@ -518,6 +528,6 @@ const VectorData = props => { ...@@ -518,6 +528,6 @@ const VectorData = props => {
listData={schemename} listData={schemename}
/> />
</> </>
) );
} };
export default VectorData export default VectorData;
\ 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