Explorar el Código

经纬度校验

hanfucheng hace 1 año
padre
commit
ef87848165
Se han modificado 1 ficheros con 11 adiciones y 4 borrados
  1. 11 4
      data-ui/src/views/data/common/ISuperMap.vue

+ 11 - 4
data-ui/src/views/data/common/ISuperMap.vue

@@ -78,10 +78,8 @@
       },
       init(sign, form,NB,type) {
         const regex = /^\d+(\.\d+)?$/;
-        if (this.$parent.form.latitude == null||this.$parent.form.longitude == null) {
-
-        }else{
-          if (!regex.test(form.longitude) && !regex.test(form.latitude)) {
+        if (this.$parent.form.longitude != null) {
+          if (!regex.test(form.longitude) ) {
             this.$message.warning('无效字符');
             this.visible = false;
             this.$parent.ISuperMapvisible = false;
@@ -89,6 +87,15 @@
             this.$parent.form.longitude = null;
           }
         }
+        if (this.$parent.form.latitude != null) {
+          if (!regex.test(form.latitude)) {
+            this.$message.warning('无效字符');
+            this.visible = false;
+            this.$parent.ISuperMapvisible = false;
+            this.$parent.form.latitude = null;
+            this.$parent.form.longitude  = null;
+          }
+        }
         if(NB=='NB'){
           getConfigKey('supermapKey').then(response => {
             let isN = response.msg;