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

fix: 'gis地图配置方案配置新增可选择基础底图或者分级底图

parent bfe5494d
Pipeline #52667 waiting for manual action with stages
......@@ -37,6 +37,7 @@
padding: 0 0 2rem;
}
.schemeName {
width: 68px;
margin-right: 0.8rem;
font-weight: bold;
}
......@@ -93,7 +94,7 @@
height: 100%;
display: flex;
align-items: center;
width: 3rem;
width: 41px;
justify-content: center;
}
.mapText {
......
......@@ -486,7 +486,7 @@ const AddModal = props => {
};
return (
<Modal
title="添加底图"
title="添加基础底图"
bodyStyle={{ width: '100%', maxHeight: '600px', overflow: 'scroll', minHeight: '360px' }}
style={{ top: '150px' }}
width="700px"
......
......@@ -66,9 +66,9 @@ const AddProjectModal = props => {
if (res.code === 0) {
form.resetFields();
callBackSubmit();
prompt('success', '瓦片新增成功');
prompt('success', '基础底图新增成功');
} else {
prompt('fail', '瓦片新增失败');
prompt('fail', '基础底图新增失败');
}
})
.catch(err => {
......@@ -117,9 +117,9 @@ const AddProjectModal = props => {
if (res.code === 0) {
form.resetFields();
callBackSubmit();
prompt('success', '方案新增成功');
prompt('success', '分级底图新增成功');
} else {
prompt('fail', '方案新增失败');
prompt('fail', '分级底图新增失败');
}
})
.catch(err => {
......@@ -220,7 +220,7 @@ const AddProjectModal = props => {
const handleBaseMap = () => {};
return (
<Modal
title={`${type === 'add' ? '添加底图' : '添加底图方案'}`}
title={`${type === 'add' ? '添加基础底图' : '添加分级底图'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="700px"
......@@ -238,27 +238,10 @@ const AddProjectModal = props => {
<Form form={form} {...layout} onFinish={onFinish}>
{type === 'add' ? (
<>
<Item
label="服务名"
name="serverName"
rules={[{ required: true, message: '请输入服务名' }]}
>
<Select onChange={handleChange}>
{serviceList.length
? serviceList.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select>
</Item>
<Item
label={
<div>
<Tooltip title="同一底图方案中的不同底图缩放级别不能相同">
<Tooltip title="同一分级底图中的不同基础底图级别不能相同">
<InfoCircleOutlined
style={{
color: 'rgb(24, 144, 255)',
......@@ -267,19 +250,19 @@ const AddProjectModal = props => {
}}
/>
</Tooltip>
<span>缩放级别</span>
<span>级别</span>
</div>
}
name="zoom"
rules={[
{ required: true, message: '请输入缩放级别' },
{ required: true, message: '请输入级别' },
{
validator: (rule, value) => {
const obj = form.getFieldsValue().zoom;
console.log(obj);
if (arr.indexOf(obj) != -1) {
console.log(111);
return Promise.reject('已存在该缩放级别的底图');
return Promise.reject('已存在该级别的基础底图');
}
return Promise.resolve();
},
......@@ -288,20 +271,37 @@ const AddProjectModal = props => {
>
<InputNumber min={0} />
</Item>
<Item
label="基础底图"
name="serverName"
rules={[{ required: true, message: '请输入基础底图' }]}
>
<Select onChange={handleChange}>
{serviceList.length
? serviceList.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select>
</Item>
</>
) : (
<>
<Item
label="方案名"
label="名称"
name="schemename"
rules={[{ required: true, message: '请输入方案名' }]}
rules={[{ required: true, message: '请输入名称' }]}
>
<Input placeholder="请输入方案名" allowClear />
<Input placeholder="请输入名称" allowClear />
</Item>
<Item
label="默认底图"
label="默认基础底图"
name="baseMap"
rules={[{ required: true, message: '请选择底图' }]}
rules={[{ required: true, message: '请选择基础底图' }]}
>
<Select onChange={handleBaseMap}>
{baseMap.length
......
......@@ -3,7 +3,7 @@
* @Description:
* @Author: leizhe
* @Date: 2022-05-25 15:07:30
* @LastEditTime: 2022-06-02 17:20:19
* @LastEditTime: 2022-06-10 15:36:33
* @LastEditors: leizhe
*/
import React, { useState, useEffect } from 'react';
......@@ -113,7 +113,7 @@ const BaseMap = props => {
<>
<span>编辑</span>
<span style={{ color: 'rgb(24, 144, 255)' }}>{keepProject}</span>
<span>缩放级别</span>
<span>的级别</span>
</>
);
return (
......@@ -135,7 +135,7 @@ const BaseMap = props => {
<Item
label={
<div>
<Tooltip title="同一底图方案中的不同底图缩放级别不能相同">
<Tooltip title="同一分级底图中的不同基础底图级别不能相同">
<InfoCircleOutlined
style={{
color: 'rgb(24, 144, 255)',
......@@ -144,20 +144,20 @@ const BaseMap = props => {
}}
/>
</Tooltip>
<span>缩放级别</span>
<span>级别</span>
</div>
}
style={{ marginTop: '20px' }}
name="zoom"
rules={[
{ required: true, message: '请输入缩放级别' },
{ required: true, message: '请输入级别' },
{
validator: (rule, value) => {
const obj = form.getFieldsValue().zoom;
console.log(obj);
if (arr.indexOf(obj) != -1) {
console.log(111);
return Promise.reject('已存在该缩放级别的底图');
return Promise.reject('已存在该级别的基础底图');
}
return Promise.resolve();
},
......
......@@ -200,7 +200,7 @@ const EditModal = props => {
return (
<Modal
title={`${type === 'add' ? '添加' : '编辑'}底图`}
title={`${type === 'add' ? '添加' : '编辑'}基础底图`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="700px"
......
......@@ -458,7 +458,7 @@ const NewEditModal = props => {
};
return (
<Modal
title="编辑底图"
title="编辑基础底图"
bodyStyle={{ width: '100%', maxHeight: '600px', overflow: 'scroll' }}
style={{ top: '150px' }}
width="700px"
......
......@@ -226,8 +226,8 @@ const TileData = props => {
<Divider orientation="left">
<div className={styles.divider}>
{' '}
底图{' '}
<Tooltip title="新增底图">
基础底图{' '}
<Tooltip title="新增基础底图">
<PlusOutlined
onClick={() => {
handleAdd();
......@@ -250,8 +250,8 @@ const TileData = props => {
/>
<Divider orientation="left" style={{ marginTop: '50px' }}>
<div className={styles.divider}>
底图分级显示方案{' '}
<Tooltip title="新增底图方案">
分级底图{' '}
<Tooltip title="新增分级底图">
<PlusOutlined
onClick={() => {
addType();
......
......@@ -38,14 +38,14 @@ const CardData = props => {
notification.success({
message: '提示',
duration: 3,
description: '底图删除成功',
description: '基础底图删除成功',
});
deletebaseMaps();
} else {
notification.error({
message: '提示',
duration: 3,
description: '底图删除失败',
description: '基础底图删除失败',
});
}
});
......@@ -61,14 +61,14 @@ const CardData = props => {
notification.success({
message: '提示',
duration: 3,
description: '方案删除成功',
description: '分级底图删除成功',
});
deletebaseMaps();
} else {
notification.error({
message: '提示',
duration: 3,
description: '方案删除失败',
description: '分级底图删除失败',
});
}
});
......@@ -103,7 +103,7 @@ const CardData = props => {
notification.warning({
message: '提示',
duration: 3,
description: '请先在基础配置-配置底图',
description: '请先在基础配置-配置基础底图',
});
}
});
......@@ -163,14 +163,14 @@ const CardData = props => {
<Card
title={
<div>
<span className={styles.schemeName}>方案名</span>
<span className={styles.schemeName}>名称</span>
{props.item.schemename}
</div>
}
extra={
<a href="#">
<Popconfirm
title="是否删除该方案?"
title="是否删除该分级底图?"
okText="确认"
cancelText="取消"
onConfirm={() => {
......@@ -196,11 +196,11 @@ const CardData = props => {
</Button>
</div> */}
<div className={styles.schemeItem}>
<span className={styles.schemeName}>底图</span>
<span className={styles.schemeName}>基础底图</span>
<Button className={styles.schemeBtn1} onClick={() => addTile(props.item)}>
{' '}
<PlusOutlined />
添加底图
添加基础底图
</Button>
</div>
<div style={{ overflowY: 'scroll', height: '11.4rem' }}>
......@@ -232,7 +232,7 @@ const CardData = props => {
</div>
<div className={styles.mapIcon1}>
<Popconfirm
title="是否删除该底图?"
title="是否删除该基础底图?"
okText="确认"
cancelText="取消"
onConfirm={() => {
......
/* eslint-disable indent */
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification } from 'antd';
import { Form, Modal, Input, Select, notification, Radio } from 'antd';
import {
GettMaplayer,
GetVectorService,
......@@ -10,11 +11,12 @@ import {
const { Item } = Form;
const { Option } = Select;
const AddModal = props => {
const { callBackSubmit = () => {}, type, formObj, visible, serviceList } = props;
const { callBackSubmit = () => {}, type, formObj, visible, serviceList, keepData } = props;
const [loading, setLoading] = useState(false);
const [baseMap, setBaseMap] = useState([]);
const [pipeArr, setPipeArr] = useState([]);
const [list, setList] = useState([]);
const [radio, setRadio] = useState('');
const [form] = Form.useForm();
// 提交
......@@ -32,9 +34,9 @@ const AddModal = props => {
if (res.code === 0) {
form.resetFields();
callBackSubmit();
prompt('success', '底图方案新增成功');
prompt('success', '分级底图新增成功');
} else {
prompt('fail', '底图方案新增失败');
prompt('fail', '分级底图新增失败');
}
});
} else {
......@@ -90,15 +92,26 @@ const AddModal = props => {
const onFinish = value => {};
useEffect(() => {
switch (type) {
case 'add':
addTile();
break;
case 'schemeAdd':
pipeNetwork();
break;
default:
break;
if (visible) {
console.log(keepData);
switch (type) {
case 'add':
addTile();
break;
case 'schemeAdd':
pipeNetwork();
setRadio('基础底图');
form.setFieldsValue({ choose: '基础底图' });
form.setFieldsValue({
baseMap: keepData[0],
});
break;
default:
break;
}
} else {
setRadio('');
form.resetFields();
}
}, [visible]);
......@@ -129,9 +142,9 @@ const AddModal = props => {
}
setPipeArr(pipeArr);
setBaseMap(baseMap);
form.setFieldsValue({
baseMap: baseMap[0],
});
// form.setFieldsValue({
// baseMap: baseMap[0],
// });
});
};
const layout = {
......@@ -155,11 +168,25 @@ const AddModal = props => {
});
};
const onChange = e => {
console.log(keepData);
setRadio(e.target.value);
if (e.target.value === '基础底图') {
form.setFieldsValue({
baseMap: keepData[0],
});
} else {
form.setFieldsValue({
baseMap: baseMap[0],
});
}
};
// 选择底图
const handleBaseMap = () => {};
return (
<Modal
title={`${type === 'add' ? '添加底图方案' : '添加方案'}`}
title={`${type === 'add' ? '添加分级底图' : '添加方案'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="700px"
......@@ -176,7 +203,7 @@ const AddModal = props => {
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
{type === 'add' ? (
<Item label="服务名" name="serverName">
<Item label="分级底图" name="serverName">
<Select onChange={handleChange}>
{serviceList.length
? serviceList.map((item, index) => {
......@@ -217,7 +244,50 @@ const AddModal = props => {
<Item label="url" name="url">
<Input placeholder="请输入url" allowClear />
</Item>
<Item
<Item name="choose" style={{ marginLeft: '110px' }}>
<Radio.Group onChange={onChange} value={radio}>
<Radio value="基础底图">基础底图</Radio>
<Radio value="分级底图">分级底图</Radio>
</Radio.Group>
</Item>
{form.getFieldsValue().choose === '分级底图' ? (
<Item
label="默认分级底图"
name="baseMap"
rules={[{ required: true, message: '请选择分级底图' }]}
>
<Select onChange={handleBaseMap}>
{baseMap.length
? baseMap.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select>
</Item>
) : (
<Item
label="默认基础底图"
name="baseMap"
rules={[{ required: true, message: '请选择基础底图' }]}
>
<Select onChange={handleBaseMap}>
{keepData.length
? keepData.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select>
</Item>
)}
{/* <Item
label="默认底图方案"
name="baseMap"
rules={[{ required: true, message: '请选择底图方案' }]}
......@@ -233,7 +303,7 @@ const AddModal = props => {
})
: ''}
</Select>
</Item>
</Item> */}
</>
)}
</Form>
......
......@@ -31,9 +31,9 @@ const AddModal = props => {
if (res.code === 0) {
form.resetFields();
callBackSubmit();
prompt('success', '瓦片新增成功');
prompt('success', '基础底图新增成功');
} else {
prompt('fail', '瓦片新增失败');
prompt('fail', '基础底图新增失败');
}
});
} else {
......@@ -157,7 +157,7 @@ const AddModal = props => {
const handleBaseMap = () => {};
return (
<Modal
title={`${type === 'add' ? '添加底图' : '添加方案'}`}
title={`${type === 'add' ? '添加基础底图' : '添加方案'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="700px"
......@@ -174,7 +174,7 @@ const AddModal = props => {
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
{type === 'add' ? (
<Item label="服务名" name="serverName">
<Item label="基础底图" name="serverName">
<Select onChange={handleChange}>
{serviceList.length
? serviceList.map((item, index) => {
......@@ -216,9 +216,9 @@ const AddModal = props => {
<Input placeholder="请输入url" allowClear />
</Item>
<Item
label="默认底图"
label="默认基础底图"
name="baseMap"
rules={[{ required: true, message: '请选择底图' }]}
rules={[{ required: true, message: '请选择基础底图' }]}
>
<Select onChange={handleBaseMap}>
{baseMap.length
......
......@@ -243,15 +243,15 @@ const CardData = props => {
</div> */}
<div className={styles.schemeItem}>
{/* <span className={styles.schemeName}>底图方案</span> */}
<Button className={styles.schemeBtn} onClick={() => addTile(props.item)}>
{' '}
<BlockOutlined />
添加底图方案
</Button>
<Button className={styles.schemeBtn} onClick={() => addTileBase(props.item)}>
{' '}
<GlobalOutlined />
添加底图
添加基础底图
</Button>
<Button className={styles.schemeBtn} onClick={() => addTile(props.item)}>
{' '}
<BlockOutlined />
添加分级底图
</Button>
</div>
<div style={{ overflowY: 'scroll', height: '11.4rem' }}>
......@@ -280,7 +280,7 @@ const CardData = props => {
<Popconfirm
title={
cardData.indexOf(baseMapItem) == -1 ? (
<span>是否删除该底图方案</span>
<span>是否删除该分级底图</span>
) : (
<span>是否删除该底图?</span>
)
......
......@@ -2,11 +2,11 @@
* @Description:
* @Author: leizhe
* @Date: 2022-01-13 10:47:32
* @LastEditTime: 2022-06-02 18:06:20
* @LastEditTime: 2022-06-10 15:13:28
* @LastEditors: leizhe
*/
/* eslint-disable indent */
import { Button, Spin } from 'antd';
import { Button, Spin, Empty } from 'antd';
import React, { useState, useEffect } from 'react';
import styles from '../SchemeConfig.less';
import { GetMaplayerByTerminalType, GettMaplayer } from '@/services/webConfig/api';
......@@ -35,6 +35,7 @@ const VectorData = props => {
setVisible(true);
};
useEffect(() => {
console.log(1212);
renderTile();
}, [flag]);
......@@ -52,8 +53,10 @@ const VectorData = props => {
resdata.data.scheme.optionalLayer.layers.map((j, index) => {
let arr = [];
res.data.general.baseMap.layers.map(i => {
console.log(i);
arr.push(i.servicename);
});
console.log(arr);
setKeepData(arr);
let data = [];
let aa = [];
......@@ -97,26 +100,28 @@ const VectorData = props => {
<div style={{ height: 'calc(100vh - 216px)', width: '100%' }}>
<div className={styles.cardsList}>
{/* {console.log(tileData)} */}
{tileData && tileData.length
? tileData.map((item, index) => {
return (
<div
className={styles.cardItem}
key={index}
span={5}
offset={2}
style={{ marginBottom: '1rem' }}
>
<Cards
item={item}
cardFlag={cardFlag}
deletebaseMaps={onDeletebaseMap}
keepData={keepData}
/>
</div>
);
})
: ''}
{tileData && tileData.length ? (
tileData.map((item, index) => {
return (
<div
className={styles.cardItem}
key={index}
span={5}
offset={2}
style={{ marginBottom: '1rem' }}
>
<Cards
item={item}
cardFlag={cardFlag}
deletebaseMaps={onDeletebaseMap}
keepData={keepData}
/>
</div>
);
})
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} style={{ margin: 'auto' }} />
)}
</div>
<AddModal
visible={visible}
......@@ -124,6 +129,7 @@ const VectorData = props => {
callBackSubmit={onSubmit}
type={type}
formObj={formObj}
keepData={keepData}
/>
</div>
</Spin>
......
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