|
@@ -14,6 +14,9 @@ import { useCommonStore, useIncidentStore } from '@/store';
|
|
|
import QueryMap from '@/components/QueryMap';
|
|
|
import { BaseMediaUrl} from '@/utils/index';
|
|
|
// import MediaUpload from '@/components/MediaUpload';
|
|
|
+
|
|
|
+/** @ts-ignore */
|
|
|
+import icon_map_location from '@/assets/icons/home/icon_map_location@2x.png';
|
|
|
import './index.scss';
|
|
|
import {
|
|
|
DropdownItemOption,
|
|
@@ -64,6 +67,9 @@ export default defineComponent({
|
|
|
const videop = ref();
|
|
|
const videopsrc = ref("");
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
const handleUpload = (file) => {
|
|
|
upload(file).then((res) => {
|
|
|
let type = /\w+([.jpg|.png|.gif|.swf|.bmp|.jpeg]){1}$/.test(
|
|
@@ -104,11 +110,105 @@ export default defineComponent({
|
|
|
|
|
|
};
|
|
|
|
|
|
+ const getLocation = () => {
|
|
|
+ if (navigator.geolocation) {
|
|
|
+ navigator.geolocation.getCurrentPosition(
|
|
|
+ (position: GeolocationPosition) => {
|
|
|
+ console.log(position.coords.longitude);
|
|
|
+ console.log(position.coords.latitude);
|
|
|
+ var location = '118.28,33.97';
|
|
|
+ // var location = `${position.coords.longitude},${position.coords.latitude}`;
|
|
|
+ fetch(
|
|
|
+ `https://minedata.cn/service/lbs/reverse/v1/regeo?location=${location}&key=${window.key}`,
|
|
|
+ )
|
|
|
+ .then((res) => res.json())
|
|
|
+ .then((data) => {
|
|
|
+ // console.log(data)
|
|
|
+ // console.log(data.regeocodes[0].formatted_address);
|
|
|
+ var ll = data.regeocodes[0].formatted_address;
|
|
|
+ if (!window.map) {
|
|
|
+ Notify({
|
|
|
+ type: 'danger',
|
|
|
+ message: '地图插件初始化异常, 请刷新页面 (Ctrl + R)',
|
|
|
+ });
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.map.flyTo({
|
|
|
+ center: [
|
|
|
+ Number(location.split(',')[0]),
|
|
|
+ Number(location.split(',')[1]),
|
|
|
+ ],
|
|
|
+ zoom: 14,
|
|
|
+ bearing: 0,
|
|
|
+ pitch: 0,
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ if (window.map && window._marker) {
|
|
|
+ window._marker.remove();
|
|
|
+ window._marker = null;
|
|
|
+ }
|
|
|
+ if (window.map) {
|
|
|
+ var el = document.createElement('div');
|
|
|
+ el.id = 'marker';
|
|
|
+ el.style.backgroundImage = `url(${icon_map_location})`;
|
|
|
+ el.style.backgroundSize = 'cover';
|
|
|
+ el.style.width = '24px';
|
|
|
+ el.style.height = '24px';
|
|
|
+ el.style.borderRadius = '50%';
|
|
|
+
|
|
|
+ const popup = new window.minemap.Popup({
|
|
|
+ closeOnClick: false,
|
|
|
+ closeButton: false,
|
|
|
+ offset: [0, -15],
|
|
|
+ }).setText(ll);
|
|
|
+
|
|
|
+ window._marker = new window.minemap.Marker(el, {
|
|
|
+ offset: [-12, -12],
|
|
|
+ })
|
|
|
+ .setLngLat([
|
|
|
+ Number(location.split(',')[0]),
|
|
|
+ Number(location.split(',')[1]),
|
|
|
+ ])
|
|
|
+ .setPopup(popup)
|
|
|
+ .addTo(window.map);
|
|
|
+ }
|
|
|
+ window._marker.togglePopup();
|
|
|
+ // var ll =
|
|
|
+ // data.regeocodes[0].formatted_address.replaceAll(
|
|
|
+ // '江苏省宿迁市',
|
|
|
+ // "");
|
|
|
+
|
|
|
+ form.value.locations = location;
|
|
|
+ form.value.addr = ll;
|
|
|
+ });
|
|
|
+ // minemap.service
|
|
|
+ // .adminByPointData({
|
|
|
+ // location: `${position.coords.longitude},${position.coords.latitude}`,
|
|
|
+ // })
|
|
|
+ // .then(function (response) {
|
|
|
+ // console.log(response.data);
|
|
|
+ // })
|
|
|
+ // .catch(function (error) {
|
|
|
+ // console.error(error);
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ (ee) => {
|
|
|
+ console.log(ee);
|
|
|
+ },
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ alert('浏览器不支持地理定位。');
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
commonStore.getGlobalDict('zhdd_incident_level');
|
|
|
commonStore.getGlobalDict('zhdd_incident_type');
|
|
|
commonStore.getGlobalDict('zhdd_org_upload');
|
|
|
|
|
|
+ getLocation();
|
|
|
+
|
|
|
route.query.id && (await store.getIncidentItem(route.query.id as string));
|
|
|
addr.value = detail?.value?.addr ?? '';
|
|
|
if (detail.value) {
|
|
@@ -291,29 +391,7 @@ export default defineComponent({
|
|
|
form.value.locations = store.incidentDetail.baseInfo?.locations;
|
|
|
}}
|
|
|
/>
|
|
|
- <Field
|
|
|
- name="上传图片"
|
|
|
- label="上传图片"
|
|
|
- placeholder="请输入"
|
|
|
- v-slots={{
|
|
|
- input: () => (
|
|
|
- <Uploader
|
|
|
- accept="image/*"
|
|
|
- v-model={form.value.pic}
|
|
|
- onDelete={(filep, detail) => {
|
|
|
- imagessrclist.splice(detail.index, 1);
|
|
|
- console.log(imagessrclist);
|
|
|
- }}
|
|
|
- afterRead={(
|
|
|
- file: UploaderFileListItem | UploaderFileListItem[],
|
|
|
- ) => {
|
|
|
- handleUpload((isArray(file) ? file[0] : file).file);
|
|
|
- return false;
|
|
|
- }}
|
|
|
- />
|
|
|
- ),
|
|
|
- }}
|
|
|
- />
|
|
|
+
|
|
|
<Field
|
|
|
name="上传视频"
|
|
|
label="上传视频"
|
|
@@ -354,6 +432,29 @@ export default defineComponent({
|
|
|
),
|
|
|
}}
|
|
|
/>
|
|
|
+ <Field
|
|
|
+ name="上传图片"
|
|
|
+ label="上传图片"
|
|
|
+ placeholder="请输入"
|
|
|
+ v-slots={{
|
|
|
+ input: () => (
|
|
|
+ <Uploader
|
|
|
+ accept="image/*"
|
|
|
+ v-model={form.value.pic}
|
|
|
+ onDelete={(filep, detail) => {
|
|
|
+ imagessrclist.splice(detail.index, 1);
|
|
|
+ console.log(imagessrclist);
|
|
|
+ }}
|
|
|
+ afterRead={(
|
|
|
+ file: UploaderFileListItem | UploaderFileListItem[],
|
|
|
+ ) => {
|
|
|
+ handleUpload((isArray(file) ? file[0] : file).file);
|
|
|
+ return false;
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ }}
|
|
|
+ />
|
|
|
</CellGroup>
|
|
|
<div style={{ height: '80px' }}></div>
|
|
|
|