From fd8e1acbc8bac690c020248b806fc4f06af1792e Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Thu, 26 Aug 2021 15:36:58 +0800
Subject: [PATCH] 禁止输入逻辑

---
 src/components/cardPopup/cardPopup.vue |   54 ++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/src/components/cardPopup/cardPopup.vue b/src/components/cardPopup/cardPopup.vue
index bfa423a..694a0cb 100644
--- a/src/components/cardPopup/cardPopup.vue
+++ b/src/components/cardPopup/cardPopup.vue
@@ -34,19 +34,19 @@
               ></avue-form>
             </el-collapse-item>
             <el-collapse-item title="附件上传/查询" name="2">
-              <attach :type="imgType"></attach>
+              <attach :type="imgType" :opens="opens"></attach>
             </el-collapse-item>
           </el-collapse>
         </div>
 
         <div class="hand-next">
           <el-button type="primary" @click="tip1up1">上一页</el-button>
-          <el-button type="primary" @click="tip1" :disabled="!canDoIt"
+          <el-button type="primary" @click="tip1" :disabled="!opens"
             >暂存</el-button
           >
-          <el-button type="primary" @click="up()" :disabled="!canDoIt">{{
+          <el-button type="primary" @click="up()" :disabled="!opens">{{
             //canDoIt ? "提交审批" : "已成功提交"
-            canDoIt ? "提交审批" : "提交审批"
+            opens ? "提交审批" : "提交审批"
           }}</el-button>
           <el-button type="info" @click="qx">取消</el-button>
         </div>
@@ -82,10 +82,11 @@
         column: [],
       },
       activeNames: ["1", "2"],
+      opens: true,
     };
   },
   computed: {
-    ...mapGetters(["useWhere", "canDoIt"]),
+    ...mapGetters(["useWhere", "canDoIt", "yanzhen"]),
   },
   watch: {
     useWhere() {
@@ -96,14 +97,23 @@
           this.type = this.data[k].type;
           this.imgType = this.data[k].imgType;
           this.htmls = this.data[k].datas.htmls;
-
           this.apiName = this.data[k].datas.apiName;
           this.name = this.data[k].menuName;
           var d = this.data[k].datas.column;
+
+          //判断是否禁用按钮
+          for (var k in this.canDoIt) {
+            if (this.canDoIt[k].type == this.type) {
+              console.log(this.type + "-------" + this.canDoIt[k].opens);
+              this.opens = this.canDoIt[k].opens;
+            }
+          }
+          //是否禁用按钮
           for (var k in d) {
-            d[k]["disabled"] = !this.canDoIt;
+            d[k]["disabled"] = !this.opens;
           }
           this.option.column = d;
+
           console.log("已选择type:" + this.useWhere + "--" + this.name);
           this.convert();
         }
@@ -155,6 +165,9 @@
         });
       });
     },
+    aa(b) {
+      console.log(b);
+    },
     up() {
       //提交申请
       var d = {};
@@ -168,6 +181,13 @@
       this.data0 = d;
       this.data0.ptype = this.type;
       this.data0.cardid = this.$store.getters.userInfo.Id;
+
+      // if (!this.tipover(1, this.data0)) {
+      //   console.log("不通过");
+      //   return;
+      // }
+      // console.log(this.tipover(1, this.data0));
+      // return;
       add(this.apiName[0], this.data0).then(() => {
         this.qx();
         this.$message({
@@ -177,7 +197,25 @@
         this.$store.commit("changecanDoIt", false);
       });
     },
-    tipover() {
+
+    tipover(a, b) {
+      if (a == 1) {
+        console.log(b);
+        var number = false,
+          reg = /^[0-9]+.?[0-9]*$/;
+        for (var k in b) {
+          if (k == "creditcode") {
+            if (reg.test(b[k])) {
+              number = true;
+            } else {
+              number = false;
+            }
+          } else {
+            continue;
+          }
+        }
+        return number;
+      }
       this.forms = 1;
       this.obj0 = {
         // title0: "保安单位基本信息",

--
Gitblit v1.9.3