@@ -12,10 +12,10 @@
<div class="p-20px">
<BasicForm @register="registerForm">
<template #isShow="{ model, field }">
- disabled-test: {{ !currentLatLng && (!currentLatLng.lat || !currentLatLng.lon) }}
+ <!-- disabled: {{ (!currentLatLng.lat && !currentLatLng.lng) || !model['gpsNum'] }} -->
<Switch
:checked="model[field]"
- :disabled="!currentLatLng && (!currentLatLng.lat || !currentLatLng.lon)"
+ :disabled="(!currentLatLng.lat && !currentLatLng.lng) || !model['gpsNum']"
@change="handleUpdateSwitch"
/>
</template>
@@ -50,9 +50,15 @@
props: {
currentLatLng: {
type: Object as PropType<{
- lat: number;
- lng: number;
+ lat: number | null;
+ lng: number | null;
}>,
+ default: () => {
+ return {
+ lat: null,
+ lng: null,
+ };
+ },
},
emits: ['register', 'success', 'open-map', 'reload', 'cancel', 'update-gps'],
@@ -63,7 +63,7 @@
@open-map="handleSelectMap"
@update-gps="(val) => (currentLatLng = val)"
@reload="reload"
- @cancel="currentLatLng = undefined"
+ @cancel="currentLatLng = { lat: null, lng: null }"
:currentLatLng="currentLatLng"
<MapSelectModal
@@ -166,7 +166,10 @@
width: isJA.value ? 200 : 200,
];
- const currentLatLng = ref();
+ const currentLatLng = ref({
+ });
const searchForm: Partial<FormProps> = {
labelWidth: 100,
schemas: [
@@ -5,6 +5,7 @@
:title="isAdding ? t('layout.map.selectScene') : t('routes.dashboard.scenesList')"
@ok="handleSubmit"
:width="850"
+ submitOnReset
@cancel="handleCancel"
:closeFunc="handlecloseFunc"
>
@@ -215,14 +216,15 @@
if (isAdding.value) {
const ids = getSelectRowKeys();
console.log('handleSubmit', ids);
- isAdding.value = false;
if (ids.length > 0) {
await AddSceneApi({
projectId: Number(projectId.value),
numList: ids,
});
- reload();
+ isAdding.value = false;
+ setTimeout(reload, 300);
} else {
+ createMessage.destroy();
createMessage.error(t('modal.atLeastOne'));
}