Commit dc9a5488 authored by 田翔's avatar 田翔

fix: 地图值修改为按钮

parent 3ef4d574
import React, { useState, useRef } from 'react' import React, { useState, useRef, useMemo } from 'react'
import styles from './index.less' import styles from './index.less'
import { Button } from 'antd'
import { import {
ArcGISSceneMap, ArcGISSceneMap,
ClickQuery, ClickQuery,
...@@ -10,11 +11,11 @@ import { ...@@ -10,11 +11,11 @@ import {
SimpleLineSymbol, SimpleLineSymbol,
SimpleFillSymbol, SimpleFillSymbol,
} from '@wisdom-map/arcgismap/lib' } from '@wisdom-map/arcgismap/lib'
import { CompassOutlined } from '@ant-design/icons'
import Drag from '../../../../../components/Drag' import Drag from '../../../../../components/Drag'
import { isJson } from '../../../../../../utils/index' import { isJson } from '../../../../../../utils/index'
import point from '../../../../../../assets/images/cood/point.png' import point from '../../../../../../assets/images/cood/point.png'
let geometrystr = '' let geometrystr = ''
let gisInfo = {} let gisInfo = {}
let layer = 0 let layer = 0
...@@ -27,6 +28,16 @@ const CoordView = (props) => { ...@@ -27,6 +28,16 @@ const CoordView = (props) => {
let clickref = useRef(null) let clickref = useRef(null)
let view = useRef(null) let view = useRef(null)
const btnText = useMemo(() => {
switch (widget) {
case 'Coordinate': return '查看位置'
case 'Device': return '查看设备'
case 'DrawPath': return '查看路径'
case 'DrawArea': return '查看区域'
default: return
}
}, [widget])
const getMapInfo = (mapObj, Map) => { const getMapInfo = (mapObj, Map) => {
setTimeout(() => { setTimeout(() => {
if (widget === 'Device') { if (widget === 'Device') {
...@@ -145,7 +156,17 @@ const CoordView = (props) => { ...@@ -145,7 +156,17 @@ const CoordView = (props) => {
return ( return (
<div className={styles.coordView}> <div className={styles.coordView}>
<span onClick={() => setVisible(true)}>{value}</span> {
value ? (
<Button
size='small'
icon={<CompassOutlined />}
onClick={() => setVisible(true)}
>
{btnText}
</Button>
) : null
}
<Drag <Drag
visible={visible} visible={visible}
title={title} title={title}
......
.coordView { .coordView {
display: flex;
justify-content: center;
align-items: center;
&:hover { &:hover {
cursor: pointer; cursor: pointer;
color: #1890ff; color: #1890ff;
......
...@@ -106,7 +106,7 @@ const DrawArea = (props) => { ...@@ -106,7 +106,7 @@ const DrawArea = (props) => {
<Input <Input
disabled={disabled} disabled={disabled}
placeholder={placeholder} placeholder={placeholder}
value={value} value={isJson(value) ? '已绘制' : ''}
addonAfter={disabled ? null : <CompassOutlined style={{ color: 'rgba(0, 0, 0, 0.25)' }} onClick={showMap} />} addonAfter={disabled ? null : <CompassOutlined style={{ color: 'rgba(0, 0, 0, 0.25)' }} onClick={showMap} />}
style={{ width: '100%' }} style={{ width: '100%' }}
onClick={showMap} onClick={showMap}
......
...@@ -105,7 +105,7 @@ const DrawPath = (props) => { ...@@ -105,7 +105,7 @@ const DrawPath = (props) => {
<Input <Input
disabled={disabled} disabled={disabled}
placeholder={placeholder} placeholder={placeholder}
value={value} value={isJson(value) ? '已绘制' : ''}
addonAfter={disabled ? null : <CompassOutlined style={{ color: 'rgba(0, 0, 0, 0.25)' }} onClick={showMap} />} addonAfter={disabled ? null : <CompassOutlined style={{ color: 'rgba(0, 0, 0, 0.25)' }} onClick={showMap} />}
style={{ width: '100%' }} style={{ width: '100%' }}
onClick={showMap} onClick={showMap}
......
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