Browse Source

fix:工位增加ip校验

lupeng 1 year ago
parent
commit
90141efb44
2 changed files with 20 additions and 2 deletions
  1. 1 1
      .env.development
  2. 19 1
      src/views/base/modeling/station/index.vue

+ 1 - 1
.env.development

@@ -12,7 +12,7 @@ VITE_APP_UPLOAD_URL = 'http://192.168.101.4:9000'
 # 开发接口地址
 # VITE_APP_API_URL = 'http://192.168.101.4:8078'
 #VITE_APP_API_URL = 'http://192.168.101.188:8078'
- VITE_APP_API_URL = 'http://192.168.101.4:8078'  #lup
+ VITE_APP_API_URL = 'http://192.168.101.30:8078'  #lup
 #VITE_APP_API_URL = 'http://192.168.101.64:8078'  #hetao
 
 # 是否启用 Mock 服务

+ 19 - 1
src/views/base/modeling/station/index.vue

@@ -95,7 +95,25 @@
   //   menu: true,
   // });
   function rowSave(form,done,loading) {
-    console.info(form);
+    const parts = form.stationIp.split('.');
+    if (parts.length !== 4) {
+      ElMessage({
+        message: "工位ip格式不正确",
+        type: "error",
+      });
+      loading();
+      return false;
+    }
+    for (const part of parts) {
+      if (isNaN(part) || part < 0 || part > 255) {
+        ElMessage({
+          message: "工位ip格式不正确",
+          type: "error",
+        });
+        loading();
+        return false;
+      }
+    }
     createRow(form,done,loading);
 
   }