AddModal.jsx 26 KB
Newer Older
皮倩雯's avatar
皮倩雯 committed
1 2 3 4 5 6 7 8
/* eslint-disable camelcase */
/* eslint-disable jsx-a11y/alt-text */
/* 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 */
9
import React, { useState, useEffect } from 'react';
10 11 12 13 14 15 16 17 18 19 20 21 22
import {
  Form,
  Modal,
  Input,
  Select,
  notification,
  Slider,
  InputNumber,
  Row,
  Col,
  Image,
  Radio,
  Button,
皮倩雯's avatar
皮倩雯 committed
23
  Switch,
24 25
} from 'antd';
import styles from '../SchemeConfig.less';
26 27 28 29
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';
皮倩雯's avatar
皮倩雯 committed
30 31 32 33 34 35 36
import classnames from 'classnames';
import {
  SetServiceConfig,
  GetCustomBaseMapList,
  GetGridSetList,
  GetCustomBaseMapByName,
} from '@/services/webConfig/api';
37 38 39
const { Item } = Form;
const { Option } = Select;
const AddModal = props => {
40
  const { callBackSubmit = () => {}, type, formObj, visible, baseMap, name, onCancel } = props;
41 42
  const [loading, setLoading] = useState(false);
  const [radio, setRadio] = useState();
43
  const [alpha, setAlpha] = useState(1);
44
  const [mapType, setMapType] = useState(0);
皮倩雯's avatar
皮倩雯 committed
45 46 47 48 49 50
  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('');
51 52
  const [o, setO] = useState('');
  const [r, setR] = useState('');
皮倩雯's avatar
皮倩雯 committed
53
  const [current, setCurrent] = useState(false);
54
  const [type1, setType] = useState(0);
55
  const [form] = Form.useForm();
56
  const [radio1, setRadio1] = useState();
57 58 59 60 61 62
  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',
  ];
63 64 65 66 67

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

皮倩雯's avatar
皮倩雯 committed
131 132
          SetServiceConfig(arr)
            .then(res => {
133
              if (res.code == '0') {
134 135
                onCancel();
                setLoading(false);
皮倩雯's avatar
皮倩雯 committed
136 137 138 139 140 141 142 143
                form.resetFields();
                callBackSubmit();
                notification.success({
                  message: '提示',
                  duration: 3,
                  description: res.message || type == 'add' ? '新增成功' : '编辑成功',
                });
              } else {
144
                setLoading(false);
皮倩雯's avatar
皮倩雯 committed
145 146 147 148 149 150 151 152 153 154 155
                notification.error({
                  message: '提示',
                  duration: 3,
                  description: res.message || type == 'add' ? '新增失败' : '编辑失败',
                });
              }
            })
            .catch(err => {
              setLoading(false);
            });
        }
156 157 158
      }
    });
  };
159

160
  const onFinish = value => {};
161
  useEffect(() => {
162
    setLoading(false);
皮倩雯's avatar
皮倩雯 committed
163
    setMapType(0);
164
    setType(0);
皮倩雯's avatar
皮倩雯 committed
165
    setAdvanced(0);
皮倩雯's avatar
皮倩雯 committed
166
    setCurrent(false);
皮倩雯's avatar
皮倩雯 committed
167
    setPickItem('');
168
    setAlpha(1);
皮倩雯's avatar
皮倩雯 committed
169
    console.log(baseMap);
170 171
    switch (type) {
      case 'add':
172
        setRadio1(0);
173 174 175
        setRadio('');
        form.resetFields();
        form.setFieldsValue({
皮倩雯's avatar
皮倩雯 committed
176 177 178 179 180 181 182 183 184
          servicename: '高德地形',
          label: '高德地形',
          type: 'amap-v',
          gis: 'geoserver217',
          IP: '192.168.12.7',
          proxy: 'javasvc.panda-water.cn/geoserver',
          Port: '8080',
          User: 'admin',
          Pwd: 'geoserver',
185
          isTainDiTu: 0,
皮倩雯's avatar
皮倩雯 committed
186
          levelEndEnlarge: false,
187 188
        });

189 190
        break;
      case 'edit':
191
        console.log(formObj);
192
        setRadio1(formObj.isTainDiTu || 0);
193
        form.setFieldsValue({ ...formObj });
194
        let index = formObj.icon.lastIndexOf('/');
195 196 197
        let str = formObj.icon.substring(index + 1, formObj.icon.length);
        let defaultIndex = arr.filter((item, index) => {
          if (item.indexOf(str) !== -1) {
198
            return index;
199
          }
200 201
        });
        setRadio(defaultIndex[0]);
202 203 204 205
        break;
      default:
        break;
    }
206 207 208 209 210 211
    // if (form.getFieldsValue('').servicename && baseMap.indexOf(form.getFieldsValue('').servicename) == 2 || baseMap.indexOf(form.getFieldsValue('').servicename) == 3) {
    //   setMapType(1)
    // }
    // else {
    //   setMapType(0)
    // }
212 213 214 215 216 217 218 219
  }, [visible]);

  const layout = {
    layout: 'horizontal',
    labelCol: {
      span: 4,
    },
    wrapperCol: {
220
      span: 18,
221 222
    },
  };
223
  const onChange = value => {
皮倩雯's avatar
皮倩雯 committed
224
    let silderData = value == 100 ? 1 : value / 100;
225 226
    setAlpha(silderData);
  };
227
  const tipFormatter = value => `${value}%`;
228 229 230

  const imgURL = [
    {
231
      url: thumbnail_1,
232 233
    },
    {
234
      url: thumbnail_2,
235 236
    },
    {
237
      url: thumbnail_3,
238 239
    },
    {
240
      url: thumbnail_4,
241
    },
242
  ];
243

244 245 246 247
  const radioChange = e => {
    setRadio(e.target.value);
  };
  const handleChange = value => {
皮倩雯's avatar
皮倩雯 committed
248 249 250
    console.log(value);
    setAdvanced(0);
    setCurrent(false);
251
    form.setFieldsValue({
皮倩雯's avatar
皮倩雯 committed
252 253
      label: servicenameToType(value),
      servicename: servicenameToType(value),
254
    });
皮倩雯's avatar
皮倩雯 committed
255 256 257 258 259
    if (value == 'google-user' || value == 'pipenet-tile') {
      setMapType(1);
    } else {
      setMapType(0);
    }
260 261 262 263 264
    if (value == 'offline-map') {
      setType(1);
    } else {
      setType(0);
    }
265
  };
皮倩雯's avatar
皮倩雯 committed
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 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
  // 添加地图类型
  const servicenameToType = type => {
    // console.log(name);
    // let random = Math.floor(Math.random() * 100) + 1;
    // if (type == 'google-v') {
    //   let aa = `谷歌地形${random}`;
    //   if (name.indexOf(aa) != -1) {
    //     servicenameToType(type);
    //   } else {
    //     return `谷歌地形${random}`;
    //   }
    // } else if (type == 'google-i-a') {
    //   let aa = `谷歌影像(注记)${random}`;
    //   if (name.indexOf(aa) != -1) {
    //     servicenameToType(type);
    //   } else {
    //     return `谷歌影像(注记)${random}`;
    //   }
    // } else if (type == 'google-i') {
    //   let aa = `谷歌影像${random}`;
    //   if (name.indexOf(aa) != -1) {
    //     servicenameToType(type);
    //   } else {
    //     return `谷歌影像${random}`;
    //   }
    // } else if (type == 'amap-i') {
    //   let aa = `高德影像${random}`;
    //   if (name.indexOf(aa) != -1) {
    //     servicenameToType(type);
    //   } else {
    //     return `高德影像${random}`;
    //   }
    // } else if (type == 'amap-v') {
    //   let aa = `高德地形${random}`;
    //   if (name.indexOf(aa) != -1) {
    //     servicenameToType(type);
    //   } else {
    //     return `高德地形${random}`;
    //   }
    // } else if (type == 'tianditu-i-ia') {
    //   let aa = `天地图影像${random}`;
    //   if (name.indexOf(aa) != -1) {
    //     servicenameToType(type);
    //   } else {
    //     return `天地图影像${random}`;
    //   }
    // } else if (type == 'tianditu-v-va') {
    //   let aa = `天地图地形${random}`;
    //   if (name.indexOf(aa) != -1) {
    //     servicenameToType(type);
    //   } else {
    //     return `天地图地形${random}`;
    //   }
    // } else if (type == 'google-user') {
    //   let aa = `自定义底图${random}`;
    //   if (name.indexOf(aa) != -1) {
    //     servicenameToType(type);
    //   } else {
    //     return `自定义底图${random}`;
    //   }
    // } else if (type == 'pipenet-tile') {
    //   let aa = `地形图${random}`;
    //   if (name.indexOf(aa) != -1) {
    //     servicenameToType(type);
    //   } else {
    //     return `地形图${random}`;
    //   }
    // }

    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 '天地图地形';
350 351 352 353 354 355
      case 'streetPurplishBlue':
        return 'GeoQ午夜蓝';
      case 'streetGray':
        return 'GeoQ水墨灰';
      case 'streetWarm':
        return 'GeoQ暖色';
356 357
      case 'mapbox-i-ia':
        return 'mapbox影像';
358
      case 'tianditu-arcgis-i':
359
        return 'arcgis影像';
皮倩雯's avatar
皮倩雯 committed
360 361
      case 'arcgis-i-ia':
        return 'arcgis影像注记';
362 363
      case 'offline-map':
        return '离线地图';
皮倩雯's avatar
皮倩雯 committed
364 365 366 367
      // case 'google-user':
      //   return;
      // case 'pipenet-tile':
      //   return;
368
      default:
369
    }
370
  };
皮倩雯's avatar
皮倩雯 committed
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 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446
  // 选择坐标系
  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());
447 448
      setO(`-${JSON.parse(aa)[2]},${JSON.parse(aa)[3]}`);
      setR(res.results.resolutions);
皮倩雯's avatar
皮倩雯 committed
449 450 451 452 453 454 455 456 457 458 459
      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) {
      setAdvanced(1);
皮倩雯's avatar
皮倩雯 committed
460
      setCurrent(true);
皮倩雯's avatar
皮倩雯 committed
461 462
    } else {
      setAdvanced(0);
皮倩雯's avatar
皮倩雯 committed
463
      setCurrent(false);
皮倩雯's avatar
皮倩雯 committed
464 465 466 467
    }
    console.log(e);
    console.log(event);
  };
468

皮倩雯's avatar
皮倩雯 committed
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519
  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
520 521 522 523 524

  const marks = {
    0: '0%',
    100: '100%',
  };
525 526 527 528

  const onChange1 = e => {
    setRadio1(e.target.value);
  };
529 530
  return (
    <Modal
531
      title="添加基础底图"
532
      bodyStyle={{ width: '100%', maxHeight: '600px', overflow: 'scroll', minHeight: '300px' }}
533 534 535 536 537 538 539 540 541 542 543 544 545 546
      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}>
皮倩雯's avatar
皮倩雯 committed
547 548
          <Item label="类型" name="type" rules={[{ required: true, message: '请选择服务名' }]}>
            <Select onChange={handleChange}>
皮倩雯's avatar
皮倩雯 committed
549 550 551 552 553 554
              <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>
555 556 557
              <Option value="streetPurplishBlue">GeoQ午夜蓝(streetPurplishBlue)</Option>
              <Option value="streetGray">GeoQ水墨灰(streetGray)</Option>
              <Option value="streetWarm">GeoQ暖色(streetWarm)</Option>
558
              <Option value="mapbox-i-ia">mapbox影像(mapbox-i-ia)</Option>
559
              <Option value="tianditu-arcgis-i">arcgis影像(tianditu-arcgis-i)</Option>
皮倩雯's avatar
皮倩雯 committed
560
              <Option value="arcgis-i-ia">arcgis影像注记(arcgis-i-ia)</Option>
561
              <Option value="offline-map">离线地图(offline-map)</Option>
皮倩雯's avatar
皮倩雯 committed
562 563
            </Select>
          </Item>
564 565 566
          <Item
            label="服务名"
            name="servicename"
皮倩雯's avatar
皮倩雯 committed
567 568 569 570 571 572 573 574 575 576 577 578 579
            rules={[
              {
                required: true,
                validator: (rule, value) => {
                  if (name.indexOf(form.getFieldsValue().servicename) != -1) {
                    return Promise.reject('服务名称已存在');
                  } else if (form.getFieldsValue().servicename == '') {
                    return Promise.reject('服务名称不能为空');
                  }
                  return Promise.resolve();
                },
              },
            ]}
580
          >
皮倩雯's avatar
皮倩雯 committed
581
            <Input placeholder="请输入服务名称" allowClear />
582
          </Item>
583
          <Item label="标签" name="label" rules={[{ required: true, message: '请输入标签' }]}>
皮倩雯's avatar
皮倩雯 committed
584
            <Input placeholder="请输入标签名" allowClear />
585
          </Item>
皮倩雯's avatar
皮倩雯 committed
586
          {/* <Item label="URL" name="url">
587
            <Input placeholder="请输入URL" allowClear />
皮倩雯's avatar
皮倩雯 committed
588
          </Item> */}
589
          {/* <Item label="透明度" name="alpha">
皮倩雯's avatar
皮倩雯 committed
590
            <Slider
皮倩雯's avatar
皮倩雯 committed
591
              marks={marks}
皮倩雯's avatar
皮倩雯 committed
592 593 594 595 596
              min={0}
              max={100}
              onChange={onChange}
              // step={0.1}
              tipFormatter={tipFormatter}
皮倩雯's avatar
皮倩雯 committed
597
              // tooltipVisible
皮倩雯's avatar
皮倩雯 committed
598 599
              defaultValue={100}
            />
600
          </Item> */}
皮倩雯's avatar
皮倩雯 committed
601 602
          <Item
            label="选择缩略图"
皮倩雯's avatar
皮倩雯 committed
603
            name="icon"
皮倩雯's avatar
皮倩雯 committed
604 605 606
            rules={[{ required: true, message: '请选择缩略图' }]}
          >
            <div style={{ display: 'flex', justifyContent: 'space-around' }}>
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624
              {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}>
625
                      <Radio value={arr[index]} />
皮倩雯's avatar
皮倩雯 committed
626
                    </Radio.Group> */}
627 628
                </div>
              ))}
629 630
            </div>
          </Item>
631 632 633 634 635
          {type1 === 1 && (
            <>
              <Item label="URL" name="url" rules={[{ required: true, message: '请输入url' }]}>
                <Input placeholder="请输入url" allowClear />
              </Item>
636
              <Item label="注记URL" name="taggingUrl">
637 638
                <Input placeholder="请输入url" allowClear />
              </Item>
639 640 641 642 643 644
              <Item label="天地图坐标系" name="isTainDiTu">
                <Radio.Group onChange={onChange1} value={radio1}>
                  <Radio value={0}></Radio>
                  <Radio value={1}></Radio>
                </Radio.Group>
              </Item>
645 646
            </>
          )}
皮倩雯's avatar
皮倩雯 committed
647
          {/* <Item label="缩略图" name="icon" rules={[{ required: true, message: '请选择缩略图' }]}>
皮倩雯's avatar
皮倩雯 committed
648
            <Input placeholder="请输入URL" disabled />
皮倩雯's avatar
皮倩雯 committed
649
          </Item> */}
650
          {mapType === 1 ? (
651
            <>
652
              <Item label="ip地址" name="IP" rules={[{ required: true, message: '请输入ip地址' }]}>
653 654
                <Input placeholder="请输入ip地址" allowClear />
              </Item>
皮倩雯's avatar
皮倩雯 committed
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673
              <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>
674 675 676 677 678
              <Item
                label="工作空间"
                name="workSpance"
                rules={[{ required: true, message: '请选择工作空间' }]}
              >
皮倩雯's avatar
皮倩雯 committed
679 680
                <Select onChange={handleWorkSpance}>
                  {keyData
681 682 683 684 685
                    ? keyData.map((item, index) => (
                        <Option value={item} key={index}>
                          {item}
                        </Option>
                      ))
皮倩雯's avatar
皮倩雯 committed
686 687
                    : ''}
                </Select>
688 689 690 691 692 693
              </Item>
              <Item
                label="图层名"
                name="layer"
                rules={[{ required: true, message: '请选择图层名' }]}
              >
皮倩雯's avatar
皮倩雯 committed
694 695
                <Select onChange={handleLayer}>
                  {data
696 697 698 699 700
                    ? data.map((item, index) => (
                        <Option value={item} key={index}>
                          {item}
                        </Option>
                      ))
皮倩雯's avatar
皮倩雯 committed
701 702
                    : ''}
                </Select>
703 704 705 706 707 708
              </Item>
              <Item
                label="坐标系名"
                name="coordinate"
                rules={[{ required: true, message: '请选择坐标系名' }]}
              >
皮倩雯's avatar
皮倩雯 committed
709 710
                <Select onChange={handleCoordinate}>
                  {areaData
711 712 713 714 715
                    ? areaData.map((item, index) => (
                        <Option value={item} key={index}>
                          {item}
                        </Option>
                      ))
皮倩雯's avatar
皮倩雯 committed
716 717
                    : ''}
                </Select>
718 719 720 721 722 723 724 725 726 727 728
              </Item>

              <Item
                label="底图范围"
                name="range"
                rules={[{ required: true, message: '请选择底图范围' }]}
              >
                <Input placeholder="xmin,ymin,xmax,ymax" allowClear />
              </Item>
              <Item
                label="起始级别"
皮倩雯's avatar
皮倩雯 committed
729
                name="levelStart"
730 731 732 733 734 735
                rules={[{ required: true, message: '请选择起始级别' }]}
              >
                <Input placeholder="最初显示级别" allowClear />
              </Item>
              <Item
                label="最大级别"
皮倩雯's avatar
皮倩雯 committed
736 737
                name="levelEnd"
                // rules={[{ required: true, message: '请选择最大级别' }]}
738 739 740
              >
                <Input placeholder="最大显示级别" allowClear />
              </Item>
皮倩雯's avatar
皮倩雯 committed
741 742 743 744 745 746 747 748 749 750 751
              <Item
                label="放大级别后继续放大"
                name="levelEndEnlarge"
                // rules={[{ required: true }]}
                labelCol={{ span: 7 }}
              >
                <Radio.Group>
                  <Radio value={false}></Radio>
                  <Radio value={true}></Radio>
                </Radio.Group>
              </Item>
752 753 754 755 756 757 758
              <Item
                label="代理url"
                name="proxy"
                rules={[{ required: true, message: '请选择缩略图' }]}
              >
                <Input placeholder="请输入URL" allowClear />
              </Item>
皮倩雯's avatar
皮倩雯 committed
759 760 761 762
              <Switch
                checkedChildren="高级设置"
                unCheckedChildren="高级设置"
                onChange={change}
皮倩雯's avatar
皮倩雯 committed
763
                checked={current}
皮倩雯's avatar
皮倩雯 committed
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802
                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>
                </>
              ) : (
                ''
              )}
803
            </>
804 805 806
          ) : (
            ''
          )}
807 808 809 810 811 812
        </Form>
      )}
    </Modal>
  );
};
export default AddModal;