|
|
@@ -61,9 +61,8 @@
|
|
|
</BasicModal>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
- import { computed, defineComponent, onUnmounted, ref, unref, watch } from 'vue';
|
|
|
+ import { computed, defineComponent, onDeactivated, ref, unref, watch } from 'vue';
|
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
|
- import { FormSchema, useForm } from '/@/components/Form/index';
|
|
|
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
import {
|
|
|
@@ -76,44 +75,7 @@
|
|
|
import { useLocaleStore } from '/@/store/modules/locale';
|
|
|
|
|
|
const { t } = useI18n();
|
|
|
- const schemas: FormSchema[] = [
|
|
|
- {
|
|
|
- field: 'projectName',
|
|
|
- label: t('layout.map.projectName'),
|
|
|
- component: 'Input',
|
|
|
- colProps: {
|
|
|
- span: 24,
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'projectSn',
|
|
|
- label: t('layout.map.projectSn'),
|
|
|
- component: 'Input',
|
|
|
- colProps: {
|
|
|
- span: 24,
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'location',
|
|
|
- label: t('layout.map.location'),
|
|
|
- component: 'Input',
|
|
|
- slot: 'location',
|
|
|
- colProps: {
|
|
|
- span: 24,
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'isShow',
|
|
|
- label: t('layout.map.isShow'),
|
|
|
- component: 'Switch',
|
|
|
- colProps: {
|
|
|
- span: 24,
|
|
|
- },
|
|
|
- componentProps: {
|
|
|
- defaultChecked: true,
|
|
|
- },
|
|
|
- },
|
|
|
- ];
|
|
|
+
|
|
|
const localeStore = useLocaleStore();
|
|
|
export default defineComponent({
|
|
|
components: { BasicModal, GoogleMap, CustomControl, AdvancedMarker },
|
|
|
@@ -129,7 +91,7 @@
|
|
|
emits: ['register', 'success', 'update'],
|
|
|
setup(props, { emit }) {
|
|
|
// const { createMessage } = useMessage();
|
|
|
- const sceneNum = ref('');
|
|
|
+ // const sceneNum = ref('');
|
|
|
const location = ref('');
|
|
|
const loadingRef = ref(true);
|
|
|
const center = { lat: 35.717, lng: 139.731 };
|
|
|
@@ -142,25 +104,16 @@
|
|
|
|
|
|
const lang = computed(() => localeStore.getLocale);
|
|
|
|
|
|
- const [registerForm, { setFieldsValue }] = useForm({
|
|
|
- schemas: schemas,
|
|
|
- labelWidth: 100,
|
|
|
- showActionButtonGroup: false,
|
|
|
- actionColOptions: {
|
|
|
- span: 24,
|
|
|
- },
|
|
|
- // submitFunc: handleSubmit,
|
|
|
- });
|
|
|
- const [register, { closeModal }] = useModalInner((data) => {
|
|
|
+ const [register, { closeModal }] = useModalInner((_) => {
|
|
|
console.warn('useModalInner-entry');
|
|
|
- resetMapview();
|
|
|
- data && onDataReceive(data);
|
|
|
+ // resetMapview();
|
|
|
+ // data && onDataReceive(data);
|
|
|
});
|
|
|
watch(
|
|
|
() => [mapRef.value?.ready, props.currentLatLng],
|
|
|
([ready, currentLatLng]) => {
|
|
|
if (!ready) return;
|
|
|
- console.log('ready', ready);
|
|
|
+ console.log('ready', ready, unref(currentLatLng));
|
|
|
|
|
|
loadingRef.value = false;
|
|
|
const map = mapRef.value.map;
|
|
|
@@ -210,7 +163,7 @@
|
|
|
});
|
|
|
}, 600);
|
|
|
}
|
|
|
- if (ready && currentLatLng?.lat && currentLatLng?.lng) {
|
|
|
+ if (currentLatLng?.lat && currentLatLng?.lng) {
|
|
|
// debugger;
|
|
|
console.warn('entry');
|
|
|
setTimeout(() => {
|
|
|
@@ -226,6 +179,8 @@
|
|
|
map.setCenter(searchMarker.value);
|
|
|
map.setZoom(17);
|
|
|
}, 800);
|
|
|
+ } else {
|
|
|
+ resetMapview();
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
@@ -233,17 +188,19 @@
|
|
|
},
|
|
|
);
|
|
|
|
|
|
- function onDataReceive(data) {
|
|
|
- console.log('Data Received', data);
|
|
|
- setFieldsValue({
|
|
|
- ...data,
|
|
|
- });
|
|
|
+ // function onDataReceive(data) {
|
|
|
+ // console.log('Data Received', data);
|
|
|
+ // data &&
|
|
|
+ // setFieldsValue({
|
|
|
+ // ...data,
|
|
|
+ // });
|
|
|
|
|
|
- sceneNum.value = data.num;
|
|
|
- }
|
|
|
+ // // sceneNum.value = data.num;
|
|
|
+ // }
|
|
|
|
|
|
const resetMapview = () => {
|
|
|
if (unref(searchMarkerRef).marker) {
|
|
|
+ console.warn('resetMapview');
|
|
|
searchMarkerRef.value.marker.position = { lat: 0, lng: 0 };
|
|
|
}
|
|
|
searchMarkerShow.value = false;
|
|
|
@@ -270,7 +227,7 @@
|
|
|
emit('update', searchMarker.value);
|
|
|
}
|
|
|
resetMapview();
|
|
|
- closeModal();
|
|
|
+ setTimeout(closeModal, 200);
|
|
|
};
|
|
|
const handleCancel = async () => {
|
|
|
resetMapview();
|
|
|
@@ -278,16 +235,14 @@
|
|
|
const handleRsize = () => {
|
|
|
console.log('handleRsize');
|
|
|
};
|
|
|
- onUnmounted(() => {
|
|
|
- console.log('onUnmounted', onUnmounted);
|
|
|
+ onDeactivated(() => {
|
|
|
+ console.warn('onDeactivated');
|
|
|
});
|
|
|
return {
|
|
|
t,
|
|
|
register,
|
|
|
- schemas,
|
|
|
handleSubmit,
|
|
|
closeModal,
|
|
|
- registerForm,
|
|
|
location,
|
|
|
handleMapClick,
|
|
|
loadingRef,
|