From 0b79f12774e4deef6d8b60a7f9176cad689f2a47 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Mon, 30 Aug 2021 15:29:45 +0800
Subject: [PATCH] 数据验证  加去掉无用变量

---
 src/components/cardPopup/cardPopup.vue |   41 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/src/components/cardPopup/cardPopup.vue b/src/components/cardPopup/cardPopup.vue
index 3747594..c6f3647 100644
--- a/src/components/cardPopup/cardPopup.vue
+++ b/src/components/cardPopup/cardPopup.vue
@@ -126,7 +126,7 @@
     };
   },
   computed: {
-    ...mapGetters(["userInfo", "useWhere", "canDoIt", "yanzhen"]),
+    ...mapGetters(["userInfo", "useWhere"]),
   },
   watch: {
     useWhere() {
@@ -202,10 +202,10 @@
                   if (item.ptype == val) {
                     if (item.type == 0 || item.type == 2) {
                       this.changeBut(false, d);
-                      console.log(item, "有数据未审核或者审核不通过");
+                      console.log(item, "有数据未审核或者审核通过");
                     } else {
                       this.changeBut(true, d);
-                      console.log(item, "审核通过");
+                      console.log(item, "审核不通过");
                     }
                   }
                 });
@@ -227,9 +227,11 @@
       var caridid = this.$store.getters.userInfo.Id;
       selectIn(this.apiName[2], caridid, this.type).then((res) => {
         var d = res.data.data;
+        // console.log(d, "d");
         for (var k in d) {
           this.obj0[k.toLowerCase()] = d[k];
         }
+        // console.log(this.obj0, "obj0");
       });
     },
     tip0() {
@@ -287,6 +289,39 @@
       // }
       // console.log(this.tipover(1, this.data0));
       // return;
+
+      //验证数据
+      var commin = true;
+      var a = this.data0;
+      for (var k in a) {
+        if (k == "representativecell" || k == "contactscell") {
+          //电话验证
+          if (!yanzhengphons.test(a[k])) {
+            commin = false;
+            break;
+          }
+        } else if (k == "creditcode" || k == "registeredcapital") {
+          //数字验证
+          if (!yanzhengnumbers.test(a[k])) {
+            commin = false;
+            break;
+          }
+        } else {
+          //空值验证
+          if (a[k] == "") {
+            commin = false;
+            break;
+          }
+        }
+      }
+      if (!commin) {
+        this.$message({
+          message: "请检查输入数据是否正确!",
+          type: "warning",
+        });
+        return;
+      }
+
       add(this.apiName[0], this.data0).then(() => {
         this.qx();
         this.$message({

--
Gitblit v1.9.3