zy-react-library 1.0.96 → 1.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,6 +22,8 @@ export interface MapSelectorProps {
|
|
|
22
22
|
area?: string;
|
|
23
23
|
/** 是否显示所属区域 */
|
|
24
24
|
showArea?: boolean;
|
|
25
|
+
/** 是否只查看 */
|
|
26
|
+
disable?: boolean;
|
|
25
27
|
/** 确认选择回调 */
|
|
26
28
|
onConfirm?: (longitude: number | string, latitude: number | string, extra: { area: string }) => void;
|
|
27
29
|
}
|
|
@@ -13,6 +13,7 @@ const MapSelector = (props) => {
|
|
|
13
13
|
onConfirm,
|
|
14
14
|
area = "",
|
|
15
15
|
showArea = false,
|
|
16
|
+
disable = false,
|
|
16
17
|
} = props;
|
|
17
18
|
|
|
18
19
|
const mapContainerRef = useRef(null);
|
|
@@ -66,14 +67,16 @@ const MapSelector = (props) => {
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
// 添加点击事件
|
|
69
|
-
|
|
70
|
-
map.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
if (!disable) {
|
|
71
|
+
map.addEventListener("click", (event) => {
|
|
72
|
+
map.clearOverlays();
|
|
73
|
+
const point = new window.BMapGL.Point(event.latlng.lng, event.latlng.lat);
|
|
74
|
+
const marker = new window.BMapGL.Marker(point);
|
|
75
|
+
map.addOverlay(marker);
|
|
76
|
+
setCurrentLatitude(event.latlng.lat);
|
|
77
|
+
setCurrentLongitude(event.latlng.lng);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
setLoading(false);
|
|
@@ -149,10 +152,19 @@ const MapSelector = (props) => {
|
|
|
149
152
|
open={visible}
|
|
150
153
|
title="坐标"
|
|
151
154
|
onCancel={handleClose}
|
|
152
|
-
onOk={handleConfirm}
|
|
153
155
|
width={1000}
|
|
154
156
|
destroyOnHidden={false}
|
|
155
157
|
afterClose={handleAfterClose}
|
|
158
|
+
footer={[
|
|
159
|
+
<Button key="back" onClick={handleClose}>
|
|
160
|
+
取消
|
|
161
|
+
</Button>,
|
|
162
|
+
!disable && (
|
|
163
|
+
<Button key="submit" type="primary" onClick={handleConfirm}>
|
|
164
|
+
确定
|
|
165
|
+
</Button>
|
|
166
|
+
),
|
|
167
|
+
]}
|
|
156
168
|
>
|
|
157
169
|
<Form labelAlign="right" labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
|
|
158
170
|
{
|
|
@@ -169,20 +181,24 @@ const MapSelector = (props) => {
|
|
|
169
181
|
</Row>
|
|
170
182
|
)
|
|
171
183
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
<
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
{
|
|
185
|
+
!disable && (
|
|
186
|
+
<Row gutter={24}>
|
|
187
|
+
<Col span={12}>
|
|
188
|
+
<Form.Item label="关键字搜索">
|
|
189
|
+
<Input value={localSearch} onChange={e => setLocalSearch(e.target.value)} allowClear />
|
|
190
|
+
</Form.Item>
|
|
191
|
+
</Col>
|
|
192
|
+
<Col span={12}>
|
|
193
|
+
<Form.Item label=" " colon={false}>
|
|
194
|
+
<Button type="primary" onClick={handleLocalSearch}>
|
|
195
|
+
搜索
|
|
196
|
+
</Button>
|
|
197
|
+
</Form.Item>
|
|
198
|
+
</Col>
|
|
199
|
+
</Row>
|
|
200
|
+
)
|
|
201
|
+
}
|
|
186
202
|
<Row gutter={24}>
|
|
187
203
|
<Col span={12}>
|
|
188
204
|
<Form.Item label="经度">
|