gemercheung 1 год назад
Родитель
Сommit
b438ae5ee2
3 измененных файлов с 19 добавлено и 8 удалено
  1. 10 4
      src/views/map/addProjectModal.vue
  2. 5 2
      src/views/map/list.vue
  3. 4 2
      src/views/map/sceneModal.vue

+ 10 - 4
src/views/map/addProjectModal.vue

@@ -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'],

+ 5 - 2
src/views/map/list.vue

@@ -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({
+        lat: null,
+        lng: null,
+      });
       const searchForm: Partial<FormProps> = {
         labelWidth: 100,
         schemas: [

+ 4 - 2
src/views/map/sceneModal.vue

@@ -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'));
           }
         } else {