NewEditModal.jsx 24.1 KB
Newer Older
皮倩雯's avatar
皮倩雯 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
/* eslint-disable jsx-a11y/alt-text */
/* eslint-disable no-unused-vars */
/* eslint-disable no-else-return */
/* eslint-disable prefer-promise-reject-errors */
/* eslint-disable indent */
/* eslint-disable react/jsx-boolean-value */
/* eslint-disable no-case-declarations */
/* eslint-disable no-shadow */
import React, { useState, useEffect } from 'react';
import {
  Form,
  Modal,
  Input,
  Select,
  notification,
  Slider,
  InputNumber,
  Row,
  Col,
  Image,
  Radio,
  Button,
  Switch,
} from 'antd';
import styles from '../SchemeConfig.less';
import thumbnail_1 from '@/assets/images/thumbnail/thumbnail_1.jpg';
import thumbnail_2 from '@/assets/images/thumbnail/thumbnail_2.jpg';
import thumbnail_3 from '@/assets/images/thumbnail/thumbnail_3.jpg';
import thumbnail_4 from '@/assets/images/thumbnail/thumbnail_4.jpg';
import classnames from 'classnames';
import {
  SetServiceConfig,
  GetCustomBaseMapList,
  GetGridSetList,
  GetCustomBaseMapByName,
} from '@/services/webConfig/api';
const { Item } = Form;
const { Option } = Select;
const NewEditModal = props => {
40
  const { callBackSubmit = () => {}, type, formObj, visible, baseMap, name, onCancel } = props;
皮倩雯's avatar
皮倩雯 committed
41 42 43 44 45 46 47 48 49 50
  const [loading, setLoading] = useState(false);
  const [radio, setRadio] = useState();
  const [alpha, setAlpha] = useState(1);
  const [mapType, setMapType] = useState(0);
  const [advanced, setAdvanced] = useState(0);
  const [spaceData, setSpaceData] = useState([]);
  const [keyData, setKeyData] = useState([]);
  const [data, setData] = useState([]);
  const [areaData, setAreaData] = useState([]);
  const [pickItem, setPickItem] = useState('');
皮倩雯's avatar
皮倩雯 committed
51
  const [current, setCurrent] = useState(false);
52
  const [type1, setType] = useState(0);
皮倩雯's avatar
皮倩雯 committed
53
  const [form] = Form.useForm();
54
  const [radio1, setRadio1] = useState();
皮倩雯's avatar
皮倩雯 committed
55 56 57 58 59 60 61 62 63 64 65
  const arr = [
    'assets/images/thumbnail/thumbnail_1.jpg',
    'assets/images/thumbnail/thumbnail_2.jpg',
    'assets/images/thumbnail/thumbnail_3.jpg',
    'assets/images/thumbnail/thumbnail_4.jpg',
  ];

  // 提交
  const onSubmit = () => {
    form.validateFields().then(validate => {
      if (validate) {
66
        setLoading(true);
皮倩雯's avatar
皮倩雯 committed
67 68
        let obj = form.getFieldsValue();
        let arr = {};
皮倩雯's avatar
皮倩雯 committed
69
        console.log(mapType);
皮倩雯's avatar
皮倩雯 committed
70 71 72 73 74 75
        if (mapType == 1) {
          arr = {
            servicename: obj.servicename,
            terminalType: 'base',
            isBaseMap: true,
            jsonCfg: JSON.stringify({
76
              alpha,
皮倩雯's avatar
皮倩雯 committed
77 78
              label: obj.label,
              url: obj.url,
79
              taggingUrl: obj.taggingUrl,
皮倩雯's avatar
皮倩雯 committed
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
              icon: obj.icon,
              type: obj.type,
              extent: obj.range,
              baseLayer: obj.layer,
              proxyUrl: obj.proxy,
              levelStart: obj.levelStart,
              origin: obj.origin,
              resolution: obj.resolution,
              tileMatrix: obj.coordinate,
              levelEnd: obj.levelEnd,
              levelEndEnlarge: obj.levelEndEnlarge,
              m_Ip: obj.IP,
              m_Port: obj.Port,
              m_User: obj.User,
              m_Pwd: obj.Pwd,
              gsAppName: obj.gis,
            }),
          };
        } else {
99 100 101 102 103 104 105 106 107
          let url = '';
          if (obj.type == 'streetPurplishBlue') {
            url = '//map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer';
          } else if (obj.type == 'streetGray') {
            url = '//map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetGray/MapServer';
          } else if (obj.type == 'streetWarm') {
            url = '//map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetWarm/MapServer';
          } else if (obj.type == 'mapbox-i-ia') {
            url = '//api.mapbox.com/v4/mapbox.satellite';
108
          } else if (obj.type == 'tianditu-arcgis-i') {
109
            url = '//services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer';
110
          }
皮倩雯's avatar
皮倩雯 committed
111 112 113 114 115
          arr = {
            servicename: obj.servicename,
            terminalType: 'base',
            isBaseMap: true,
            jsonCfg: JSON.stringify({
116
              alpha,
皮倩雯's avatar
皮倩雯 committed
117
              label: obj.label,
118 119
              url: obj.url || url,
              taggingUrl: obj.taggingUrl,
皮倩雯's avatar
皮倩雯 committed
120 121
              icon: obj.icon,
              type: obj.type,
122
              isTainDiTu: obj.isTainDiTu,
123 124 125 126 127 128 129 130 131 132 133 134 135 136
              extent: null,
              baseLayer: null,
              proxyUrl: null,
              levelStart: null,
              origin: null,
              resolution: null,
              tileMatrix: null,
              levelEnd: null,
              levelEndEnlarge: false,
              m_Ip: null,
              m_Port: null,
              m_User: null,
              m_Pwd: null,
              gsAppName: null,
皮倩雯's avatar
皮倩雯 committed
137 138 139 140 141 142
            }),
          };
        }

        SetServiceConfig(arr)
          .then(res => {
143
            if (res.code == '0') {
皮倩雯's avatar
皮倩雯 committed
144
              form.resetFields();
145 146
              onCancel();
              setLoading(false);
皮倩雯's avatar
皮倩雯 committed
147 148 149 150 151 152 153
              callBackSubmit();
              notification.success({
                message: '提示',
                duration: 3,
                description: res.message || type == 'add' ? '新增成功' : '编辑成功',
              });
            } else {
154
              setLoading(false);
皮倩雯's avatar
皮倩雯 committed
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
              notification.error({
                message: '提示',
                duration: 3,
                description: res.message || type == 'add' ? '新增失败' : '编辑失败',
              });
            }
          })
          .catch(err => {
            setLoading(false);
          });
      }
    });
  };

  const onFinish = value => {};
  useEffect(() => {
171 172 173 174 175
    setLoading(false);
    setSpaceData([]);
    setKeyData([]);
    setData([]);
    setAreaData([]);
皮倩雯's avatar
皮倩雯 committed
176 177 178 179 180 181 182 183 184
    console.log(formObj);
    setAlpha(formObj.alpha);
    let aa;
    if (formObj.baseLayer) {
      let index = formObj.baseLayer.lastIndexOf(':');
      aa = formObj.baseLayer.substring(0, index);
      console.log(aa);
    }
    console.log(formObj.baseLayer);
皮倩雯's avatar
皮倩雯 committed
185
    if (formObj.type == 'pipenet-tile' || formObj.type == 'google-user') {
皮倩雯's avatar
皮倩雯 committed
186 187 188 189
      setMapType(1);
    } else {
      setMapType(0);
    }
190 191 192 193 194
    if (formObj.type == 'offline-map') {
      setType(1);
    } else {
      setType(0);
    }
皮倩雯's avatar
皮倩雯 committed
195 196
    if (formObj.m_User) {
      setAdvanced(1);
皮倩雯's avatar
皮倩雯 committed
197
      setCurrent(true);
皮倩雯's avatar
皮倩雯 committed
198 199
    } else {
      setAdvanced(0);
皮倩雯's avatar
皮倩雯 committed
200
      setCurrent(false);
皮倩雯's avatar
皮倩雯 committed
201
    }
202 203
    console.log(formObj.isTainDiTu);
    setRadio1(formObj.isTainDiTu);
皮倩雯's avatar
皮倩雯 committed
204 205
    switch (type) {
      case 'edit':
206
        console.log(formObj);
207

皮倩雯's avatar
皮倩雯 committed
208 209
        form.setFieldsValue({
          ...formObj,
210
          isTainDiTu: formObj.isTainDiTu,
皮倩雯's avatar
皮倩雯 committed
211 212 213 214 215 216 217 218 219 220
          IP: formObj.m_Ip,
          gis: formObj.gsAppName,
          layer: formObj.baseLayer,
          coordinate: formObj.tileMatrix,
          range: formObj.extent,
          proxy: formObj.proxyUrl,
          Port: formObj.m_Port,
          User: formObj.m_User,
          Pwd: formObj.m_Pwd,
          workSpance: aa,
221
          // type: `${formObj.servicename}(${formObj.type})`,
皮倩雯's avatar
皮倩雯 committed
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
        });
        let index = formObj.icon.lastIndexOf('/');
        console.log(index);
        let str = formObj.icon.substring(index + 1, formObj.icon.length);
        console.log(str);
        let defaultIndex = arr.filter((item, index) => {
          if (item.indexOf(str) != -1) {
            return item;
          }
        });
        console.log(defaultIndex);
        if (str.indexOf(1) != -1) {
          setPickItem(0);
        } else if (str.indexOf(2) != -1) {
          setPickItem(1);
        } else if (str.indexOf(3) != -1) {
          setPickItem(2);
        } else if (str.indexOf(4) != -1) {
          setPickItem(3);
        }
        setRadio(defaultIndex[0]);
        break;
      default:
        break;
    }
  }, [visible]);

  const layout = {
    layout: 'horizontal',
    labelCol: {
      span: 4,
    },
    wrapperCol: {
      span: 18,
    },
  };
  const onChange = value => {
    let silderData = value == 100 ? 1 : value / 100;
    setAlpha(silderData);
  };
262
  const tipFormatter = value => `${value}%`;
皮倩雯's avatar
皮倩雯 committed
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283

  const imgURL = [
    {
      url: thumbnail_1,
    },
    {
      url: thumbnail_2,
    },
    {
      url: thumbnail_3,
    },
    {
      url: thumbnail_4,
    },
  ];

  const radioChange = e => {
    console.log(e.target.value);
    setRadio(e.target.value);
  };
  const handleChange = value => {
皮倩雯's avatar
皮倩雯 committed
284 285 286 287
    // form.setFieldsValue({
    //   label: servicenameToType(value),
    //   servicename: servicenameToType(value),
    // });
皮倩雯's avatar
皮倩雯 committed
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
    console.log(value);
    if (value == 'google-user' || value == 'pipenet-tile') {
      setMapType(1);
      console.log(form.getFieldsValue().IP);
      console.log(form.getFieldsValue().gis);
      if (!form.getFieldsValue().IP) {
        form.setFieldsValue({
          IP: '192.168.12.7',
          gis: 'geoserver217',
          proxy: 'javasvc.panda-water.cn/geoserver',
          levelEndEnlarge: false,
          Port: '8080',
          User: 'admin',
          Pwd: 'geoserver',
        });
      }
    } else {
      setMapType(0);
    }
307 308 309 310 311
    if (value == 'offline-map') {
      setType(1);
    } else {
      setType(0);
    }
皮倩雯's avatar
皮倩雯 committed
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
  };
  // 添加地图类型
  const servicenameToType = type => {
    switch (type) {
      case 'google-v':
        return '谷歌地形';
      case 'google-i-a':
        return '谷歌影像(注记)';
      case 'google-i':
        return '谷歌影像';
      case 'amap-i':
        return '高德影像';
      case 'amap-v':
        return '高德地形';
      case 'tianditu-i-ia':
        return '天地图影像';
      case 'tianditu-v-va':
        return '天地图地形';
      // case 'google-user':
      //   return;
      // case 'pipenet-tile':
      //   return;
      default:
    }
  };
  // 选择坐标系
  const handleCoordinate = e => {
    let work = form.getFieldsValue().workSpance;
    let lay = form.getFieldsValue().layer;
    let index = lay.indexOf(':');
    let result = lay.substr(index + 1, lay.length);
    console.log(result);
    getGetCustomBaseMapByName(work, result, e);
  };
  // 选择图层
  const handleLayer = e => {
    let index = e.indexOf(':');
    let result = e.substr(index + 1, e.length);
    console.log(result);
    let work = form.getFieldsValue().workSpance;
    console.log(work);
    getGetGridSetList(work, result);
  };
  // 选择工作空间
  const handleWorkSpance = e => {
    console.log(e);
    setData(spaceData[e]);
    form.setFieldsValue({ layer: spaceData[e][0] });
    let aa = form.getFieldsValue().layer;
    let index = aa.indexOf(':');
    let result = aa.substr(index + 1, aa.length);
    console.log(result);
    getGetGridSetList(e, result);
  };

  const getGetGridSetList = (a, bb) => {
    let obj = form.getFieldsValue();
    let aa = form.getFieldsValue().layer;
    let result;
    if (aa) {
      let index = aa.indexOf(':');
      result = aa.substr(index + 1, aa.length);
      console.log(result);
    }
    GetGridSetList({
      m_Port: obj.Port || '8080',
      m_User: obj.User || 'admin',
      m_Pwd: obj.Pwd || 'geoserver',
      m_Ip: obj.IP || '192.168.12.7',
      gsAppName: obj.gis || 'geoserver217',
      layerName: bb,
      workSpaceName: a,
    }).then(res => {
      let data = [];
      console.log(res.results);
      res.results.map(i => {
        data.push(i.gridSetName);
      });
      console.log(data);
      setAreaData(data);
      form.setFieldsValue({ coordinate: data[0] });
      getGetCustomBaseMapByName(a, bb, data[0]);
    });
  };

  const getGetCustomBaseMapByName = (a, bb, cc) => {
    let obj = form.getFieldsValue();
    GetCustomBaseMapByName({
      m_Port: obj.Port || '8080',
      m_User: obj.User || 'admin',
      m_Pwd: obj.Pwd || 'geoserver',
      m_Ip: obj.IP || '192.168.12.7',
      gsAppName: obj.gis || 'geoserver217',
      layerName: bb,
      workSpaceName: a,
      gridSet: cc,
    }).then(res => {
      let aa = res.results.coords;
      console.log(JSON.parse(aa)[2]);
      console.log(JSON.parse(aa)[3]);
      console.log(JSON.parse(aa).toString());
      form.setFieldsValue({
        range: JSON.parse(aa).toString(),
        resolution: res.results.resolutions,
        origin: `-${JSON.parse(aa)[2]},${JSON.parse(aa)[3]}`,
        levelStart: '3',
      });
    });
  };
  const change = (e, event) => {
    if (e) {
皮倩雯's avatar
皮倩雯 committed
423
      setCurrent(true);
皮倩雯's avatar
皮倩雯 committed
424 425
      setAdvanced(1);
    } else {
皮倩雯's avatar
皮倩雯 committed
426
      setCurrent(false);
皮倩雯's avatar
皮倩雯 committed
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482
      setAdvanced(0);
    }
    console.log(e);
    console.log(event);
  };

  const choose = () => {
    let obj = form.getFieldsValue();
    GetCustomBaseMapList({
      m_Port: obj.Port || '8080',
      m_User: obj.User || 'admin',
      m_Pwd: obj.Pwd || 'geoserver',
      m_Ip: obj.IP || '192.168.12.7',
      gsAppName: obj.gis,
    }).then(res => {
      if (res.IsSuccess == true) {
        console.log(res.results);
        console.log(Object.keys(res.results));
        setSpaceData(res.results);
        setKeyData(Object.keys(res.results));
        let aa = Object.keys(res.results)[0];
        setData(res.results[aa]);
        let bb = res.results[aa];
        let index = bb[0].indexOf(':');
        let result = bb[0].substr(index + 1, bb[0].length);
        console.log(result);
        getGetGridSetList(aa, result);
        form.setFieldsValue({ workSpance: aa, layer: bb[0] });
      } else {
        setSpaceData([]);
        setKeyData([]);
        setData([]);
        setAreaData([]);
        form.setFieldsValue({
          workSpance: '',
          layer: '',
          coordinate: '',
          range: '',
          levelStart: '',
          levelEnd: '',
          origin: '',
          resolution: '',
        });
        notification.error({
          message: '提示',
          duration: 3,
          description: res.EMessage,
        });
      }
    });
  };
  const title = (
    <span>
      透明度<span style={{ fontWeight: 'bold', color: 'rgb(24, 144, 255)' }}>{alpha}</span>
    </span>
  );
皮倩雯's avatar
皮倩雯 committed
483 484 485 486 487

  const marks = {
    0: '0%',
    100: '100%',
  };
488 489 490 491 492

  const onChange1 = e => {
    setRadio1(e.target.value);
  };

皮倩雯's avatar
皮倩雯 committed
493 494
  return (
    <Modal
495
      title="编辑基础底图"
皮倩雯's avatar
皮倩雯 committed
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
      bodyStyle={{ width: '100%', maxHeight: '600px', overflow: 'scroll' }}
      style={{ top: '150px' }}
      width="700px"
      destroyOnClose
      maskClosable={false}
      cancelText="取消"
      okText="确认"
      {...props}
      onOk={() => onSubmit()}
      confirmLoading={loading}
      forceRender={true}
      getContainer={false}
    >
      {visible && (
        <Form form={form} {...layout} onFinish={onFinish}>
          <Item label="类型" name="type" rules={[{ required: true, message: '请选择服务名' }]}>
皮倩雯's avatar
皮倩雯 committed
512
            <Select onChange={handleChange}>
皮倩雯's avatar
皮倩雯 committed
513 514 515 516 517 518
              <Option value="amap-v">高德地形(amap-v)</Option>
              <Option value="amap-i">高德影像(amap-i)</Option>
              <Option value="tianditu-v-va">天地图地形(tianditu-v-va)</Option>
              <Option value="tianditu-i-ia">天地图影像(tianditu-i-ia)</Option>
              <Option value="pipenet-tile">矢量底图切片(pipenet-tile)</Option>
              <Option value="google-user">自定义底图(google-user)</Option>
519 520 521
              <Option value="streetPurplishBlue">GeoQ午夜蓝(streetPurplishBlue)</Option>
              <Option value="streetGray">GeoQ水墨灰(streetGray)</Option>
              <Option value="streetWarm">GeoQ暖色(streetWarm)</Option>
522
              <Option value="mapbox-i-ia">mapbox影像(mapbox-i-ia)</Option>
523
              <Option value="tianditu-arcgis-i">arcgis影像(tianditu-arcgis-i)</Option>
皮倩雯's avatar
皮倩雯 committed
524
              <Option value="arcgis-i-ia">arcgis影像注记(arcgis-i-ia)</Option>
525
              <Option value="offline-map">离线地图(offline-map)</Option>
皮倩雯's avatar
皮倩雯 committed
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544
            </Select>
          </Item>
          <Item
            label="服务名"
            name="servicename"
            rules={[
              {
                required: true,
              },
            ]}
          >
            <Input placeholder="请输入服务名称" disabled />
          </Item>
          <Item label="标签" name="label" rules={[{ required: true, message: '请输入标签' }]}>
            <Input placeholder="请输入标签名" allowClear />
          </Item>
          {/* <Item label="URL" name="url">
            <Input placeholder="请输入URL" allowClear />
          </Item> */}
545
          {/* <Item label="透明度" name="alpha">
皮倩雯's avatar
皮倩雯 committed
546 547
            {console.log(formObj.alpha)}
            <Slider
皮倩雯's avatar
皮倩雯 committed
548 549
              marks={marks}
              min={0}
皮倩雯's avatar
皮倩雯 committed
550 551 552 553 554 555
              max={100}
              onChange={onChange}
              tipFormatter={tipFormatter}
              // // tooltipVisible={true}
              defaultValue={formObj.alpha * 100}
            />
556
          </Item> */}
皮倩雯's avatar
皮倩雯 committed
557 558
          <Item
            label="选择缩略图"
皮倩雯's avatar
皮倩雯 committed
559
            name="icon"
皮倩雯's avatar
皮倩雯 committed
560 561 562
            rules={[{ required: true, message: '请选择缩略图' }]}
          >
            <div style={{ display: 'flex', justifyContent: 'space-around' }}>
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580
              {imgURL.map((item, index) => (
                <div
                  className={classnames({
                    [styles.imgHidden]: index !== pickItem,
                    [styles.imgItem]: index === pickItem,
                  })}
                  key={index}
                >
                  <img
                    width="100"
                    height="63"
                    src={item.url}
                    onClick={e => {
                      setPickItem(index);
                      form.setFieldsValue({ icon: arr[index] });
                    }}
                  />
                  {/* <Radio.Group options={item} onChange={radioChange} value={radio}>
皮倩雯's avatar
皮倩雯 committed
581 582
                      <Radio value={arr[index]} />
                    </Radio.Group> */}
583 584
                </div>
              ))}
皮倩雯's avatar
皮倩雯 committed
585 586
            </div>
          </Item>
587 588 589 590 591
          {type1 === 1 && (
            <>
              <Item label="URL" name="url" rules={[{ required: true, message: '请输入url' }]}>
                <Input placeholder="请输入url" allowClear />
              </Item>
592
              <Item label="注记URL" name="taggingUrl">
593 594
                <Input placeholder="请输入url" allowClear />
              </Item>
595 596 597 598 599 600
              <Item label="天地图坐标系" name="isTainDiTu">
                <Radio.Group onChange={onChange1} value={radio1}>
                  <Radio value={0}></Radio>
                  <Radio value={1}></Radio>
                </Radio.Group>
              </Item>
601 602
            </>
          )}
皮倩雯's avatar
皮倩雯 committed
603
          {/* <Item label="缩略图" name="icon" rules={[{ required: true, message: '请选择缩略图' }]}>
皮倩雯's avatar
皮倩雯 committed
604
            <Input placeholder="请输入URL" disabled />
皮倩雯's avatar
皮倩雯 committed
605
          </Item> */}
皮倩雯's avatar
皮倩雯 committed
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636
          {mapType === 1 ? (
            <>
              <Item label="ip地址" name="IP" rules={[{ required: true, message: '请输入ip地址' }]}>
                <Input placeholder="请输入ip地址" allowClear />
              </Item>
              <Row>
                <Col span={16}>
                  <Item
                    label="geoserver名"
                    name="gis"
                    rules={[{ required: true, message: '请选择缩略图' }]}
                    labelCol={{ span: 6 }}
                  >
                    <Input placeholder="请输入gis服务器名" allowClear />
                  </Item>
                </Col>
                <Col span={8}>
                  <Item>
                    <Button style={{ width: '100%' }} onClick={choose}>
                      选择工作空间
                    </Button>
                  </Item>
                </Col>
              </Row>
              <Item
                label="工作空间"
                name="workSpance"
                rules={[{ required: true, message: '请选择工作空间' }]}
              >
                <Select onChange={handleWorkSpance}>
                  {keyData
637 638 639 640 641
                    ? keyData.map((item, index) => (
                        <Option value={item} key={index}>
                          {item}
                        </Option>
                      ))
皮倩雯's avatar
皮倩雯 committed
642 643 644 645 646 647 648 649 650 651
                    : ''}
                </Select>
              </Item>
              <Item
                label="图层名"
                name="layer"
                rules={[{ required: true, message: '请选择图层名' }]}
              >
                <Select onChange={handleLayer}>
                  {data
652 653 654 655 656
                    ? data.map((item, index) => (
                        <Option value={item} key={index}>
                          {item}
                        </Option>
                      ))
皮倩雯's avatar
皮倩雯 committed
657 658 659 660 661 662 663 664 665 666
                    : ''}
                </Select>
              </Item>
              <Item
                label="坐标系名"
                name="coordinate"
                rules={[{ required: true, message: '请选择坐标系名' }]}
              >
                <Select onChange={handleCoordinate}>
                  {areaData
667 668 669 670 671
                    ? areaData.map((item, index) => (
                        <Option value={item} key={index}>
                          {item}
                        </Option>
                      ))
皮倩雯's avatar
皮倩雯 committed
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718
                    : ''}
                </Select>
              </Item>

              <Item
                label="底图范围"
                name="range"
                rules={[{ required: true, message: '请选择底图范围' }]}
              >
                <Input placeholder="xmin,ymin,xmax,ymax" allowClear />
              </Item>
              <Item
                label="起始级别"
                name="levelStart"
                rules={[{ required: true, message: '请选择起始级别' }]}
              >
                <Input placeholder="最初显示级别" allowClear />
              </Item>
              <Item
                label="最大级别"
                name="levelEnd"
                // rules={[{ required: true, message: '请选择最大级别' }]}
              >
                <Input placeholder="最大显示级别" allowClear />
              </Item>
              <Item
                label="放大级别后继续放大"
                name="levelEndEnlarge"
                // rules={[{ required: true }]}
                labelCol={{ span: 7 }}
              >
                <Radio.Group>
                  <Radio value={false}></Radio>
                  <Radio value={true}></Radio>
                </Radio.Group>
              </Item>
              <Item
                label="代理url"
                name="proxy"
                rules={[{ required: true, message: '请选择缩略图' }]}
              >
                <Input placeholder="请输入URL" allowClear />
              </Item>
              <Switch
                checkedChildren="高级设置"
                unCheckedChildren="高级设置"
                onChange={change}
皮倩雯's avatar
皮倩雯 committed
719
                checked={current}
皮倩雯's avatar
皮倩雯 committed
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768
                style={{ marginLeft: '40px', marginBottom: '15px' }}
              />
              {advanced === 1 ? (
                <>
                  <Item
                    label="端口号"
                    name="Port"
                    rules={[{ required: true, message: '请输入端口号' }]}
                  >
                    <Input placeholder="请输入端口号" allowClear />
                  </Item>
                  <Item
                    label="用户名"
                    name="User"
                    rules={[{ required: true, message: '请输入用户名' }]}
                  >
                    <Input placeholder="请输入用户名" allowClear />
                  </Item>
                  <Item label="密码" name="Pwd" rules={[{ required: true, message: '请输入密码' }]}>
                    <Input placeholder="请输入密码" allowClear />
                  </Item>
                  <Item
                    label="原点"
                    name="origin"
                    rules={[{ required: true, message: '请输入原点' }]}
                  >
                    <Input placeholder="左上角" disabled />
                  </Item>
                  <Item
                    label="分辨率"
                    name="resolution"
                    rules={[{ required: true, message: '请输入分辨率' }]}
                  >
                    <Input placeholder="0级分辨率" disabled />
                  </Item>
                </>
              ) : (
                ''
              )}
            </>
          ) : (
            ''
          )}
        </Form>
      )}
    </Modal>
  );
};
export default NewEditModal;