|
@@ -49,44 +49,46 @@ |
|
@@ -49,44 +49,46 @@ |
49
|
centered
|
49
|
centered
|
50
|
>
|
50
|
>
|
51
|
<div>
|
51
|
<div>
|
52
|
- <Form :label-col="labelCol" :colon="false" :rules="rules" :model="positionState">
|
|
|
53
|
- <Row :gutter="20" class="mt-4">
|
|
|
54
|
- <Col :span="20">
|
|
|
55
|
- <FormItem label="搜索位置">
|
|
|
56
|
- <AutoComplete
|
|
|
57
|
- v-model:value="positionState.address"
|
|
|
58
|
- :options="dataSource"
|
|
|
59
|
- style="width: 100%"
|
|
|
60
|
- placeholder="搜索位置"
|
|
|
61
|
- @search="debounceSearch"
|
|
|
62
|
- @select="handleSelect"
|
|
|
63
|
- backfill
|
|
|
64
|
- />
|
|
|
65
|
- </FormItem>
|
|
|
66
|
- </Col>
|
|
|
67
|
- </Row>
|
|
|
68
|
- <Row :gutter="20" class="">
|
|
|
69
|
- <Col :span="10">
|
|
|
70
|
- <FormItem label="经度" name="longitude">
|
|
|
71
|
- <Input
|
|
|
72
|
- @blur="redirectPosition"
|
|
|
73
|
- @change="redirectPosition"
|
|
|
74
|
- v-model:value="positionState.longitude"
|
|
|
75
|
- />
|
|
|
76
|
- </FormItem>
|
|
|
77
|
- </Col>
|
|
|
78
|
- <Col :span="10">
|
|
|
79
|
- <FormItem label="纬度" name="latitude">
|
|
|
80
|
- <Input
|
|
|
81
|
- @blur="redirectPosition"
|
|
|
82
|
- @change="redirectPosition"
|
|
|
83
|
- v-model:value="positionState.latitude"
|
|
|
84
|
- />
|
|
|
85
|
- </FormItem>
|
|
|
86
|
- </Col>
|
|
|
87
|
- </Row>
|
|
|
88
|
- </Form>
|
|
|
89
|
- <div ref="wrapRef" style="height: 300px; width: 90%" class="ml-6"></div>
|
52
|
+ <Spin :spinning="spinning">
|
|
|
53
|
+ <Form :label-col="labelCol" :colon="false" :rules="rules" :model="positionState">
|
|
|
54
|
+ <Row :gutter="20" class="mt-4">
|
|
|
55
|
+ <Col :span="20">
|
|
|
56
|
+ <FormItem label="搜索位置">
|
|
|
57
|
+ <AutoComplete
|
|
|
58
|
+ v-model:value="positionState.address"
|
|
|
59
|
+ :options="dataSource"
|
|
|
60
|
+ style="width: 100%"
|
|
|
61
|
+ placeholder="搜索位置"
|
|
|
62
|
+ @search="debounceSearch"
|
|
|
63
|
+ @select="handleSelect"
|
|
|
64
|
+ backfill
|
|
|
65
|
+ />
|
|
|
66
|
+ </FormItem>
|
|
|
67
|
+ </Col>
|
|
|
68
|
+ </Row>
|
|
|
69
|
+ <Row :gutter="20" class="">
|
|
|
70
|
+ <Col :span="10">
|
|
|
71
|
+ <FormItem label="经度" name="longitude">
|
|
|
72
|
+ <Input
|
|
|
73
|
+ @blur="redirectPosition"
|
|
|
74
|
+ @change="redirectPosition"
|
|
|
75
|
+ v-model:value="positionState.longitude"
|
|
|
76
|
+ />
|
|
|
77
|
+ </FormItem>
|
|
|
78
|
+ </Col>
|
|
|
79
|
+ <Col :span="10">
|
|
|
80
|
+ <FormItem label="纬度" name="latitude">
|
|
|
81
|
+ <Input
|
|
|
82
|
+ @blur="redirectPosition"
|
|
|
83
|
+ @change="redirectPosition"
|
|
|
84
|
+ v-model:value="positionState.latitude"
|
|
|
85
|
+ />
|
|
|
86
|
+ </FormItem>
|
|
|
87
|
+ </Col>
|
|
|
88
|
+ </Row>
|
|
|
89
|
+ </Form>
|
|
|
90
|
+ <div ref="wrapRef" style="height: 300px; width: 90%" class="ml-6"></div>
|
|
|
91
|
+ </Spin>
|
90
|
</div>
|
92
|
</div>
|
91
|
</Modal>
|
93
|
</Modal>
|
92
|
<DeptDrawer @register="registerModal" @success="handleSuccess" />
|
94
|
<DeptDrawer @register="registerModal" @success="handleSuccess" />
|
|
@@ -97,7 +99,7 @@ |
|
@@ -97,7 +99,7 @@ |
97
|
import { BasicForm, useForm } from '/@/components/Form';
|
99
|
import { BasicForm, useForm } from '/@/components/Form';
|
98
|
import { step1Schemas } from '../../config/data';
|
100
|
import { step1Schemas } from '../../config/data';
|
99
|
import { useScript } from '/@/hooks/web/useScript';
|
101
|
import { useScript } from '/@/hooks/web/useScript';
|
100
|
- import { Input, message, Modal, Form, Row, Col, AutoComplete } from 'ant-design-vue';
|
102
|
+ import { Input, message, Modal, Form, Row, Col, AutoComplete, Spin } from 'ant-design-vue';
|
101
|
import { EnvironmentTwoTone } from '@ant-design/icons-vue';
|
103
|
import { EnvironmentTwoTone } from '@ant-design/icons-vue';
|
102
|
import { upload } from '/@/api/oss/ossFileUploader';
|
104
|
import { upload } from '/@/api/oss/ossFileUploader';
|
103
|
import { BAI_DU_MAP_URL } from '/@/utils/fnUtils';
|
105
|
import { BAI_DU_MAP_URL } from '/@/utils/fnUtils';
|
|
@@ -113,6 +115,7 @@ |
|
@@ -113,6 +115,7 @@ |
113
|
import { toRaw } from 'vue';
|
115
|
import { toRaw } from 'vue';
|
114
|
import { FileItem } from '/@/components/Form/src/components/ApiUpload.vue';
|
116
|
import { FileItem } from '/@/components/Form/src/components/ApiUpload.vue';
|
115
|
import { buildUUID } from '/@/utils/uuid';
|
117
|
import { buildUUID } from '/@/utils/uuid';
|
|
|
118
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
116
|
|
119
|
|
117
|
export default defineComponent({
|
120
|
export default defineComponent({
|
118
|
components: {
|
121
|
components: {
|
|
@@ -126,6 +129,7 @@ |
|
@@ -126,6 +129,7 @@ |
126
|
Row,
|
129
|
Row,
|
127
|
Col,
|
130
|
Col,
|
128
|
DeptDrawer,
|
131
|
DeptDrawer,
|
|
|
132
|
+ Spin,
|
129
|
},
|
133
|
},
|
130
|
props: {
|
134
|
props: {
|
131
|
isUpdate: {
|
135
|
isUpdate: {
|
|
@@ -134,6 +138,7 @@ |
|
@@ -134,6 +138,7 @@ |
134
|
},
|
138
|
},
|
135
|
emits: ['next'],
|
139
|
emits: ['next'],
|
136
|
setup(props, { emit }) {
|
140
|
setup(props, { emit }) {
|
|
|
141
|
+ const { createMessage } = useMessage();
|
137
|
const orgData: any = reactive({
|
142
|
const orgData: any = reactive({
|
138
|
treeData: [],
|
143
|
treeData: [],
|
139
|
});
|
144
|
});
|
|
@@ -230,17 +235,41 @@ |
|
@@ -230,17 +235,41 @@ |
230
|
};
|
235
|
};
|
231
|
|
236
|
|
232
|
// 地图的弹框
|
237
|
// 地图的弹框
|
|
|
238
|
+ const spinning = ref<boolean>(true);
|
233
|
const visible = ref(false);
|
239
|
const visible = ref(false);
|
234
|
- const selectPosition = () => {
|
240
|
+ const selectPosition = async () => {
|
235
|
visible.value = true;
|
241
|
visible.value = true;
|
236
|
if (!positionState.longitude) {
|
242
|
if (!positionState.longitude) {
|
237
|
- positionState.longitude = '104.05326410962411';
|
|
|
238
|
- positionState.latitude = '30.54855093076791';
|
|
|
239
|
-
|
|
|
240
|
- // 根据经纬度获取详细位置
|
|
|
241
|
- if (positionState.longitude && positionState.latitude) {
|
|
|
242
|
- var pt = new BMap.Point(positionState.longitude, positionState.latitude);
|
|
|
243
|
- getAddrByPoint(pt);
|
243
|
+ let getLocalCity = new BMap.LocalCity();
|
|
|
244
|
+ let getLocation = new BMap.Geolocation();
|
|
|
245
|
+ const userAgent = navigator.userAgent;
|
|
|
246
|
+ try {
|
|
|
247
|
+ spinning.value = true;
|
|
|
248
|
+ if (
|
|
|
249
|
+ (userAgent.indexOf('Chrome') > -1 || userAgent.indexOf('WebKit') > -1) &&
|
|
|
250
|
+ userAgent.indexOf('Edg') == -1
|
|
|
251
|
+ ) {
|
|
|
252
|
+ //判断是否是谷歌 或则是谷歌的内核 '104.05326410962411'; '30.54855093076791';
|
|
|
253
|
+ await getLocalCity.get(function (res) {
|
|
|
254
|
+ positionState.longitude = res?.center.lng || '104.05326410962411';
|
|
|
255
|
+ positionState.latitude = res?.center.lat || '30.54855093076791';
|
|
|
256
|
+ var pt = new BMap.Point(positionState.longitude, positionState.latitude);
|
|
|
257
|
+ getAddrByPoint(pt);
|
|
|
258
|
+ spinning.value = false;
|
|
|
259
|
+ });
|
|
|
260
|
+ } else {
|
|
|
261
|
+ await getLocation.getCurrentPosition(function (res) {
|
|
|
262
|
+ console.log(res, res);
|
|
|
263
|
+ positionState.longitude = res?.longitude || '104.05326410962411';
|
|
|
264
|
+ positionState.latitude = res?.latitude || '30.54855093076791';
|
|
|
265
|
+ var pt = new BMap.Point(positionState.longitude, positionState.latitude);
|
|
|
266
|
+ getAddrByPoint(pt);
|
|
|
267
|
+ spinning.value = false;
|
|
|
268
|
+ });
|
|
|
269
|
+ }
|
|
|
270
|
+ } catch (err) {
|
|
|
271
|
+ console.log(err, 'err');
|
|
|
272
|
+ createMessage.error('获取定位失败');
|
244
|
}
|
273
|
}
|
245
|
initMap(positionState.longitude, positionState.latitude);
|
274
|
initMap(positionState.longitude, positionState.latitude);
|
246
|
} else {
|
275
|
} else {
|
|
@@ -498,6 +527,7 @@ |
|
@@ -498,6 +527,7 @@ |
498
|
handleSuccess,
|
527
|
handleSuccess,
|
499
|
handleTreeOrg,
|
528
|
handleTreeOrg,
|
500
|
devicePositionState,
|
529
|
devicePositionState,
|
|
|
530
|
+ spinning,
|
501
|
};
|
531
|
};
|
502
|
},
|
532
|
},
|
503
|
});
|
533
|
});
|