From d1689fab46ed065f6c191a2150a6082beffdcb75 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 29 Jun 2022 09:17:06 +0800
Subject: [PATCH] 溯源码新增修改

---
 src/views/traceability/addTraceability.vue |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/src/views/traceability/addTraceability.vue b/src/views/traceability/addTraceability.vue
index 0a52a7e..b2b7571 100644
--- a/src/views/traceability/addTraceability.vue
+++ b/src/views/traceability/addTraceability.vue
@@ -169,7 +169,7 @@
               </el-checkbox-group>
             </el-form-item>
             <el-form-item label="是否绑定溯源" prop="bind">
-              <el-switch v-model="isBind" active-text="是" inactive-text="否">
+              <el-switch v-model="isBind" active-text="是" inactive-text="否" @change="OnAutoStart">
               </el-switch>
             </el-form-item>
           </el-form>
@@ -197,8 +197,8 @@
       <el-button type="primary" @click="next" v-if="isBind">{{
         tip
       }}</el-button>
-      <el-button type="primary" @click="submit" v-if="isBtn">提 交</el-button>
-      <el-button type="primary" @click="submits" v-if="!isBtn">提 交</el-button>
+      <!-- <el-button type="primary" @click="submit" v-if="isBtn">提 交</el-button> -->
+      <el-button type="primary" @click="submit0" v-if="!isBind">提 交</el-button>
     </div>
   </el-dialog>
 </template>
@@ -216,7 +216,7 @@
       tip: "下一步",
       isShow: false,
       isBind: false,
-      isBtn: true,
+      isBtn: 1,
       wtjc: false,
       zwjc: true,
       nbjc: false,
@@ -419,14 +419,22 @@
     cnChange(data) {
       this.zwcn = data;
     },
-    //创建溯源码
-    submit() {
-      var that = this;
+    submit0(){
       if (this.isBind) {
         this.formLabelAlign["bind"] = "0";
       } else {
         this.formLabelAlign["bind"] = "1";
       }
+      if(this.isBtn==1){
+          this.submit();
+      }
+      if(this.isBtn==3){
+          this.submits();
+      }
+    },
+    //创建溯源码
+    submit() {
+      var that = this;
       that.formLabelAlign['tenantId'] = this.userInfo.tenant_id;
       that.formLabelAlign['deptId'] = this.userInfo.dept_id;
       this.$refs["formLabelAlign"].validate((valid) => {
@@ -454,9 +462,10 @@
           save(that.formLabelAlign).then(
             () => {
               that.$emit("refreshOnLoad");
-              that.$refs.formLabelAlign.resetFields();
               that.close();
               that.visible = false;
+              that.isBtn = 1;
+              that.$refs.formLabelAlign.resetFields();
               this.$message({
                 type: "success",
                 message: "操作成功!",
@@ -471,6 +480,14 @@
           return false;
         }
       });
+    },
+    //是否绑定溯源码绑定事件
+    OnAutoStart(e){
+      if(e){
+        this.isBtn = 2;
+      }else{
+        this.isBtn = 1;
+      }
     },
     //创建溯源码
     submits() {
@@ -490,6 +507,7 @@
         () => {
           that.$emit("refreshOnLoad");
           that.visible = false;
+          that.isBtn = 1;
           that.close();
           this.$message({
             type: "success",
@@ -506,7 +524,7 @@
       //清除数据,状态回归
       this.isShow = false;
       this.isBind = false;
-      this.isBtn = true;
+      this.isBtn = 1;
       this.wtjc = false;
       this.zwjc = true;
       this.nbjc = false;
@@ -551,7 +569,7 @@
           //修改按钮状态
           this.isShow = true;
           this.isBind = false;
-          this.isBtn = false;
+          this.isBtn = 3;
           //initFormData
           that.initFormData();
         } else {

--
Gitblit v1.9.3