NewEditModal.jsx 25.6 KB
Newer Older
皮倩雯's avatar
皮倩雯 committed
1
/* eslint-disable prefer-destructuring */
皮倩雯's avatar
皮倩雯 committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/* 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,
皮倩雯's avatar
皮倩雯 committed
25 26
  TreeSelect,
  Empty,
皮倩雯's avatar
皮倩雯 committed
27
} from 'antd';
皮倩雯's avatar
皮倩雯 committed
28
import jsonData from './TileMap.json';
皮倩雯's avatar
皮倩雯 committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42
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;
皮倩雯's avatar
皮倩雯 committed
43
const { TreeNode } = TreeSelect;
皮倩雯's avatar
皮倩雯 committed
44
const NewEditModal = props => {
45
  const { callBackSubmit = () => {}, type, formObj, visible, baseMap, name, onCancel } = props;
皮倩雯's avatar
皮倩雯 committed
46 47 48 49 50 51 52 53 54 55
  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
56
  const [current, setCurrent] = useState(false);
57
  const [type1, setType] = useState(0);
皮倩雯's avatar
皮倩雯 committed
58
  const [form] = Form.useForm();
59
  const [radio1, setRadio1] = useState();
皮倩雯's avatar
皮倩雯 committed
60
  const [keepJsonData, setKeepJsonData] = useState([]);
皮倩雯's avatar
皮倩雯 committed
61 62 63 64 65 66 67 68 69 70 71
  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) {
72
        setLoading(true);
皮倩雯's avatar
皮倩雯 committed
73 74
        let obj = form.getFieldsValue();
        let arr = {};
皮倩雯's avatar
皮倩雯 committed
75
        console.log(mapType);
皮倩雯's avatar
皮倩雯 committed
76 77 78 79 80 81
        if (mapType == 1) {
          arr = {
            servicename: obj.servicename,
            terminalType: 'base',
            isBaseMap: true,
            jsonCfg: JSON.stringify({
82
              alpha,
皮倩雯's avatar
皮倩雯 committed
83 84
              label: obj.label,
              url: obj.url,
85
              taggingUrl: obj.taggingUrl,
皮倩雯's avatar
皮倩雯 committed
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
              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 {
105
          let url = '';
皮倩雯's avatar
皮倩雯 committed
106 107 108
          let list = keepJsonData.find(i => i.type === obj.type);
          if (list) {
            url = list.url;
109
          }
皮倩雯's avatar
皮倩雯 committed
110 111 112 113 114 115 116 117 118 119 120
          // 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';
          // } else if (obj.type == 'tianditu-arcgis-i') {
          //   url = '//services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer';
          // }
皮倩雯's avatar
皮倩雯 committed
121 122 123 124 125
          arr = {
            servicename: obj.servicename,
            terminalType: 'base',
            isBaseMap: true,
            jsonCfg: JSON.stringify({
126
              alpha,
皮倩雯's avatar
皮倩雯 committed
127
              label: obj.label,
128 129
              url: obj.url || url,
              taggingUrl: obj.taggingUrl,
皮倩雯's avatar
皮倩雯 committed
130 131
              icon: obj.icon,
              type: obj.type,
132
              isTainDiTu: obj.isTainDiTu,
133 134 135 136 137 138 139 140 141 142 143 144 145 146
              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
147 148 149 150 151 152
            }),
          };
        }

        SetServiceConfig(arr)
          .then(res => {
153
            if (res.code == '0') {
皮倩雯's avatar
皮倩雯 committed
154
              form.resetFields();
155 156
              onCancel();
              setLoading(false);
皮倩雯's avatar
皮倩雯 committed
157 158 159 160 161 162 163
              callBackSubmit();
              notification.success({
                message: '提示',
                duration: 3,
                description: res.message || type == 'add' ? '新增成功' : '编辑成功',
              });
            } else {
164
              setLoading(false);
皮倩雯's avatar
皮倩雯 committed
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
              notification.error({
                message: '提示',
                duration: 3,
                description: res.message || type == 'add' ? '新增失败' : '编辑失败',
              });
            }
          })
          .catch(err => {
            setLoading(false);
          });
      }
    });
  };

  const onFinish = value => {};
  useEffect(() => {
皮倩雯's avatar
皮倩雯 committed
181 182 183 184 185
    let data = [];
    jsonData.forEach(item => {
      data = [...data, ...item.items];
    });
    setKeepJsonData(data);
186 187 188 189 190
    setLoading(false);
    setSpaceData([]);
    setKeyData([]);
    setData([]);
    setAreaData([]);
皮倩雯's avatar
皮倩雯 committed
191 192 193 194 195 196 197 198 199
    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
200
    if (formObj.type == 'pipenet-tile' || formObj.type == 'google-user') {
皮倩雯's avatar
皮倩雯 committed
201 202 203 204
      setMapType(1);
    } else {
      setMapType(0);
    }
205 206 207 208 209
    if (formObj.type == 'offline-map') {
      setType(1);
    } else {
      setType(0);
    }
皮倩雯's avatar
皮倩雯 committed
210 211
    if (formObj.m_User) {
      setAdvanced(1);
皮倩雯's avatar
皮倩雯 committed
212
      setCurrent(true);
皮倩雯's avatar
皮倩雯 committed
213 214
    } else {
      setAdvanced(0);
皮倩雯's avatar
皮倩雯 committed
215
      setCurrent(false);
皮倩雯's avatar
皮倩雯 committed
216
    }
217 218
    console.log(formObj.isTainDiTu);
    setRadio1(formObj.isTainDiTu);
皮倩雯's avatar
皮倩雯 committed
219 220
    switch (type) {
      case 'edit':
221
        console.log(formObj);
222

皮倩雯's avatar
皮倩雯 committed
223 224
        form.setFieldsValue({
          ...formObj,
225
          isTainDiTu: formObj.isTainDiTu,
皮倩雯's avatar
皮倩雯 committed
226 227 228 229 230 231 232 233 234 235
          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,
236
          // type: `${formObj.servicename}(${formObj.type})`,
皮倩雯's avatar
皮倩雯 committed
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 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
        });
        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);
  };
277
  const tipFormatter = value => `${value}%`;
皮倩雯's avatar
皮倩雯 committed
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298

  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
299 300 301 302
    // form.setFieldsValue({
    //   label: servicenameToType(value),
    //   servicename: servicenameToType(value),
    // });
皮倩雯's avatar
皮倩雯 committed
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321
    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);
    }
322 323
    if (value == 'offline-map') {
      setType(1);
皮倩雯's avatar
皮倩雯 committed
324
      form.setFieldsValue({ url: '' });
325 326 327
    } else {
      setType(0);
    }
皮倩雯's avatar
皮倩雯 committed
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 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
  };
  // 添加地图类型
  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
439
      setCurrent(true);
皮倩雯's avatar
皮倩雯 committed
440 441
      setAdvanced(1);
    } else {
皮倩雯's avatar
皮倩雯 committed
442
      setCurrent(false);
皮倩雯's avatar
皮倩雯 committed
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 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498
      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
499 500 501 502 503

  const marks = {
    0: '0%',
    100: '100%',
  };
504 505 506 507 508

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

皮倩雯's avatar
皮倩雯 committed
509 510 511 512 513 514 515 516 517 518 519
  const mapTree = (org, server) => {
    const haveChildren = Array.isArray(org.items) && org.items.length > 0;
    return haveChildren ? (
      <TreeNode value={org.groupName} title={org.groupName} disabled>
        {org.items.map(item => mapTree(item, org.groupName))}
      </TreeNode>
    ) : (
      <TreeNode value={org.type} title={`${org.title}(${org.type})`} />
    );
  };

皮倩雯's avatar
皮倩雯 committed
520 521
  return (
    <Modal
522
      title="编辑基础底图"
皮倩雯's avatar
皮倩雯 committed
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538
      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
539
            {/* <Select onChange={handleChange}>
皮倩雯's avatar
皮倩雯 committed
540 541 542 543 544 545
              <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>
546 547 548
              <Option value="streetPurplishBlue">GeoQ午夜蓝(streetPurplishBlue)</Option>
              <Option value="streetGray">GeoQ水墨灰(streetGray)</Option>
              <Option value="streetWarm">GeoQ暖色(streetWarm)</Option>
549
              <Option value="mapbox-i-ia">mapbox影像(mapbox-i-ia)</Option>
550
              <Option value="tianditu-arcgis-i">arcgis影像(tianditu-arcgis-i)</Option>
皮倩雯's avatar
皮倩雯 committed
551
              <Option value="arcgis-i-ia">arcgis影像注记(arcgis-i-ia)</Option>
552
              <Option value="offline-map">离线地图(offline-map)</Option>
皮倩雯's avatar
皮倩雯 committed
553
              <Option value="tianditudark-v-va">深色天地图地形(tianditudark-v-va)</Option>
皮倩雯's avatar
皮倩雯 committed
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569
            </Select> */}
            <TreeSelect
              showSearch
              dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
              placeholder="请选择底图 "
              allowClear
              treeDefaultExpandAll
              showCheckedStrategy
              onChange={handleChange}
            >
              {jsonData ? (
                jsonData.map(i => mapTree(i))
              ) : (
                <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
              )}
            </TreeSelect>
皮倩雯's avatar
皮倩雯 committed
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587
          </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> */}
588
          {/* <Item label="透明度" name="alpha">
皮倩雯's avatar
皮倩雯 committed
589 590
            {console.log(formObj.alpha)}
            <Slider
皮倩雯's avatar
皮倩雯 committed
591 592
              marks={marks}
              min={0}
皮倩雯's avatar
皮倩雯 committed
593 594 595 596 597 598
              max={100}
              onChange={onChange}
              tipFormatter={tipFormatter}
              // // tooltipVisible={true}
              defaultValue={formObj.alpha * 100}
            />
599
          </Item> */}
皮倩雯's avatar
皮倩雯 committed
600 601
          <Item
            label="选择缩略图"
皮倩雯's avatar
皮倩雯 committed
602
            name="icon"
皮倩雯's avatar
皮倩雯 committed
603 604 605
            rules={[{ required: true, message: '请选择缩略图' }]}
          >
            <div style={{ display: 'flex', justifyContent: 'space-around' }}>
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
              {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
624 625
                      <Radio value={arr[index]} />
                    </Radio.Group> */}
626 627
                </div>
              ))}
皮倩雯's avatar
皮倩雯 committed
628 629
            </div>
          </Item>
630 631 632 633 634
          {type1 === 1 && (
            <>
              <Item label="URL" name="url" rules={[{ required: true, message: '请输入url' }]}>
                <Input placeholder="请输入url" allowClear />
              </Item>
635
              <Item label="注记URL" name="taggingUrl">
636 637
                <Input placeholder="请输入url" allowClear />
              </Item>
638 639 640 641 642 643
              <Item label="天地图坐标系" name="isTainDiTu">
                <Radio.Group onChange={onChange1} value={radio1}>
                  <Radio value={0}></Radio>
                  <Radio value={1}></Radio>
                </Radio.Group>
              </Item>
644 645
            </>
          )}
皮倩雯's avatar
皮倩雯 committed
646
          {/* <Item label="缩略图" name="icon" rules={[{ required: true, message: '请选择缩略图' }]}>
皮倩雯's avatar
皮倩雯 committed
647
            <Input placeholder="请输入URL" disabled />
皮倩雯's avatar
皮倩雯 committed
648
          </Item> */}
皮倩雯's avatar
皮倩雯 committed
649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679
          {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
680 681 682 683 684
                    ? keyData.map((item, index) => (
                        <Option value={item} key={index}>
                          {item}
                        </Option>
                      ))
皮倩雯's avatar
皮倩雯 committed
685 686 687 688 689 690 691 692 693 694
                    : ''}
                </Select>
              </Item>
              <Item
                label="图层名"
                name="layer"
                rules={[{ required: true, message: '请选择图层名' }]}
              >
                <Select onChange={handleLayer}>
                  {data
695 696 697 698 699
                    ? data.map((item, index) => (
                        <Option value={item} key={index}>
                          {item}
                        </Option>
                      ))
皮倩雯's avatar
皮倩雯 committed
700 701 702 703 704 705 706 707 708 709
                    : ''}
                </Select>
              </Item>
              <Item
                label="坐标系名"
                name="coordinate"
                rules={[{ required: true, message: '请选择坐标系名' }]}
              >
                <Select onChange={handleCoordinate}>
                  {areaData
710 711 712 713 714
                    ? areaData.map((item, index) => (
                        <Option value={item} key={index}>
                          {item}
                        </Option>
                      ))
皮倩雯's avatar
皮倩雯 committed
715 716 717 718 719 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
                    : ''}
                </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
762
                checked={current}
皮倩雯's avatar
皮倩雯 committed
763 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 803 804 805 806 807 808 809 810 811
                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;