Commit 5fb162e4 authored by 皮倩雯's avatar 皮倩雯

底图方案增加最大级别配置

parent 6afc00d2
Pipeline #58902 passed with stages
/* eslint-disable prefer-promise-reject-errors */ /* eslint-disable prefer-promise-reject-errors */
/* eslint-disable indent */ /* eslint-disable indent */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification, InputNumber, Tooltip } from 'antd'; import { Form, Modal, Input, Select, notification, InputNumber, Tooltip, Row, Col } from 'antd';
import { import {
GettMaplayer, GettMaplayer,
GetVectorService, GetVectorService,
...@@ -59,6 +59,7 @@ const AddProjectModal = props => { ...@@ -59,6 +59,7 @@ const AddProjectModal = props => {
schemename: formObj.schemename, schemename: formObj.schemename,
servicename: obj.serverName, servicename: obj.serverName,
zoom: obj.zoom, zoom: obj.zoom,
maxZoom: obj.maxzoom,
}; };
SetBaseMapschemeName(data) SetBaseMapschemeName(data)
.then(res => { .then(res => {
...@@ -175,8 +176,8 @@ const AddProjectModal = props => { ...@@ -175,8 +176,8 @@ const AddProjectModal = props => {
form.resetFields(); form.resetFields();
let req1 = GettMaplayer({ terminalType: 'base', isBaseMap: true }); let req1 = GettMaplayer({ terminalType: 'base', isBaseMap: true });
let req2 = GetVectorService(); let req2 = GetVectorService();
let pipeArr = [], let pipeArr = [];
baseMap = []; let baseMap = [];
Promise.all([req1, req2]).then(res => { Promise.all([req1, req2]).then(res => {
if (res[0].code == '0') { if (res[0].code == '0') {
(res[0].data.general.baseMap.layers || []).map(item => { (res[0].data.general.baseMap.layers || []).map(item => {
...@@ -223,7 +224,7 @@ const AddProjectModal = props => { ...@@ -223,7 +224,7 @@ const AddProjectModal = props => {
title={`${type === 'add' ? '添加基础底图' : '添加分级底图'}`} title={`${type === 'add' ? '添加基础底图' : '添加分级底图'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }} bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }} style={{ top: '150px' }}
width="700px" width="600px"
destroyOnClose destroyOnClose
maskClosable={false} maskClosable={false}
cancelText="取消" cancelText="取消"
...@@ -231,14 +232,17 @@ const AddProjectModal = props => { ...@@ -231,14 +232,17 @@ const AddProjectModal = props => {
{...props} {...props}
onOk={() => onSubmit()} onOk={() => onSubmit()}
confirmLoading={loading} confirmLoading={loading}
forceRender={true} forceRender
getContainer={false} getContainer={false}
> >
{visible && ( {visible && (
<Form form={form} {...layout} onFinish={onFinish}> <Form form={form} {...layout} onFinish={onFinish}>
{type === 'add' ? ( {type === 'add' ? (
<> <>
<Row>
<Col span={14}>
<Item <Item
labelCol={{ span: 7 }}
label={ label={
<div> <div>
<Tooltip title="同一分级底图中的不同基础底图级别不能相同"> <Tooltip title="同一分级底图中的不同基础底图级别不能相同">
...@@ -250,27 +254,50 @@ const AddProjectModal = props => { ...@@ -250,27 +254,50 @@ const AddProjectModal = props => {
}} }}
/> />
</Tooltip> </Tooltip>
<span>级别</span> <span>最小级别</span>
</div> </div>
} }
name="zoom" name="zoom"
rules={[ 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.resolve();
// },
// },
]}
>
<InputNumber min={0} max={99} />
</Item>
</Col>
<Col span={10}>
<Item
labelCol={{ span: 10 }}
label="最大级别"
name="maxzoom"
rules={[
{ {
validator: (rule, value) => { validator: (rule, value) => {
const obj = form.getFieldsValue().zoom; const obj = form.getFieldsValue().zoom;
console.log(obj); const objmax = form.getFieldsValue().maxzoom;
if (arr.indexOf(obj) != -1) { if (objmax < obj) {
console.log(111); return Promise.reject('最大级别不能小于最小级别');
return Promise.reject('已存在该级别的基础底图');
} }
return Promise.resolve(); return Promise.resolve();
}, },
}, },
]} ]}
> >
<InputNumber min={0} /> <InputNumber min={0} max={99} />
</Item> </Item>
</Col>
</Row>
<Item <Item
label="基础底图" label="基础底图"
name="serverName" name="serverName"
...@@ -278,13 +305,11 @@ const AddProjectModal = props => { ...@@ -278,13 +305,11 @@ const AddProjectModal = props => {
> >
<Select onChange={handleChange}> <Select onChange={handleChange}>
{serviceList.length {serviceList.length
? serviceList.map((item, index) => { ? serviceList.map((item, index) => (
return (
<Option key={index} value={item}> <Option key={index} value={item}>
{item} {item}
</Option> </Option>
); ))
})
: ''} : ''}
</Select> </Select>
</Item> </Item>
...@@ -305,13 +330,11 @@ const AddProjectModal = props => { ...@@ -305,13 +330,11 @@ const AddProjectModal = props => {
> >
<Select onChange={handleBaseMap}> <Select onChange={handleBaseMap}>
{baseMap.length {baseMap.length
? baseMap.map((item, index) => { ? baseMap.map((item, index) => (
return (
<Option key={index} value={item}> <Option key={index} value={item}>
{item} {item}
</Option> </Option>
); ))
})
: ''} : ''}
</Select> </Select>
</Item> </Item>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* @LastEditors: leizhe * @LastEditors: leizhe
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification, InputNumber, Tooltip } from 'antd'; import { Form, Modal, Input, Select, notification, InputNumber, Tooltip, Row, Col } from 'antd';
import { import {
GettMaplayer, GettMaplayer,
GetVectorService, GetVectorService,
...@@ -34,7 +34,7 @@ const BaseMap = props => { ...@@ -34,7 +34,7 @@ const BaseMap = props => {
}); });
setArr(list); setArr(list);
let aa = keepItem.baseMapDetail.find(i => i.servicename == keepProject); let aa = keepItem.baseMapDetail.find(i => i.servicename == keepProject);
form.setFieldsValue({ zoom: aa.zoom }); form.setFieldsValue({ zoom: aa.zoom, maxzoom: aa.maxzoom });
} else { } else {
form.resetFields(); form.resetFields();
} }
...@@ -71,6 +71,7 @@ const BaseMap = props => { ...@@ -71,6 +71,7 @@ const BaseMap = props => {
schemename: keepItem.schemename, schemename: keepItem.schemename,
servicename: keepProject, servicename: keepProject,
zoom: obj.zoom, zoom: obj.zoom,
maxZoom: obj.maxzoom,
}; };
SetBaseMapschemeName(data).then(res => { SetBaseMapschemeName(data).then(res => {
if (res.code == '0') { if (res.code == '0') {
...@@ -121,18 +122,21 @@ const BaseMap = props => { ...@@ -121,18 +122,21 @@ const BaseMap = props => {
title={title} title={title}
bodyStyle={{ width: '100%', minHeight: '100px' }} bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }} style={{ top: '150px' }}
width="400px" width="600px"
destroyOnClose destroyOnClose
maskClosable={false} maskClosable={false}
cancelText="取消" cancelText="取消"
okText="确认" okText="确认"
{...props} {...props}
onOk={() => onSubmit()} onOk={() => onSubmit()}
forceRender={true} forceRender
getContainer={false} getContainer={false}
> >
<Form form={form} {...layout} onFinish={onSubmit}> <Form form={form} {...layout} onFinish={onSubmit}>
<Row>
<Col span={12}>
<Item <Item
labelCol={{ span: 8 }}
label={ label={
<div> <div>
<Tooltip title="同一分级底图中的不同基础底图级别不能相同"> <Tooltip title="同一分级底图中的不同基础底图级别不能相同">
...@@ -144,28 +148,52 @@ const BaseMap = props => { ...@@ -144,28 +148,52 @@ const BaseMap = props => {
}} }}
/> />
</Tooltip> </Tooltip>
<span>级别</span> <span>最小级别</span>
</div> </div>
} }
style={{ marginTop: '20px' }} style={{ marginTop: '20px' }}
name="zoom" name="zoom"
rules={[ 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.resolve();
// },
// },
]}
>
<InputNumber min={0} />
</Item>
</Col>
<Col span={12}>
<Item
labelCol={{ span: 6 }}
label="最大级别"
name="maxzoom"
style={{ marginTop: '20px' }}
rules={[
{ {
validator: (rule, value) => { validator: (rule, value) => {
const obj = form.getFieldsValue().zoom; const obj = form.getFieldsValue().zoom;
console.log(obj); const objmax = form.getFieldsValue().maxzoom;
if (arr.indexOf(obj) != -1) { if (objmax < obj) {
console.log(111); return Promise.reject('最大级别不能小于最小级别');
return Promise.reject('已存在该级别的基础底图');
} }
return Promise.resolve(); return Promise.resolve();
}, },
}, },
]} ]}
> >
<InputNumber min={0} style={{ width: '150px' }} /> <InputNumber min={0} max={99} />
</Item> </Item>
</Col>
</Row>
</Form> </Form>
</Modal> </Modal>
); );
......
...@@ -205,8 +205,7 @@ const CardData = props => { ...@@ -205,8 +205,7 @@ const CardData = props => {
</div> </div>
<div style={{ overflowY: 'scroll', height: '11.4rem' }}> <div style={{ overflowY: 'scroll', height: '11.4rem' }}>
{props.item.baseMapDetail && props.item.baseMapDetail.length {props.item.baseMapDetail && props.item.baseMapDetail.length
? props.item.baseMapDetail.map((baseMapItem, baseindex) => { ? props.item.baseMapDetail.map((baseMapItem, baseindex) => (
return (
<div className={styles.mapItem1} key={baseindex}> <div className={styles.mapItem1} key={baseindex}>
<div <div
// onClick={() => pick(props.item.schemename, baseindex)} // onClick={() => pick(props.item.schemename, baseindex)}
...@@ -216,7 +215,9 @@ const CardData = props => { ...@@ -216,7 +215,9 @@ const CardData = props => {
// })} // })}
className={styles.defaultTile1} className={styles.defaultTile1}
> >
{baseMapItem.zoom} {baseMapItem.maxzoom === 0
? baseMapItem.zoom
: `${baseMapItem.zoom}~${baseMapItem.maxzoom}`}
</div> </div>
<div className={styles.mapText1}> <div className={styles.mapText1}>
<Tooltip title={baseMapItem.servicename}>{baseMapItem.servicename}</Tooltip> <Tooltip title={baseMapItem.servicename}>{baseMapItem.servicename}</Tooltip>
...@@ -243,8 +244,7 @@ const CardData = props => { ...@@ -243,8 +244,7 @@ const CardData = props => {
</Popconfirm>{' '} </Popconfirm>{' '}
</div> </div>
</div> </div>
); ))
})
: ''} : ''}
</div> </div>
</Card> </Card>
......
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