From a2b823373db0235f2b42669596f69a126b722961 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 27 Sep 2022 11:03:24 +0800
Subject: [PATCH] 加工产品加工加工数量和产品数量不能为负数

---
 src/views/farmplant/process.vue |   46 +++++++++++++++++++++++++++-------------------
 1 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/src/views/farmplant/process.vue b/src/views/farmplant/process.vue
index b134c68..8b76f52 100644
--- a/src/views/farmplant/process.vue
+++ b/src/views/farmplant/process.vue
@@ -293,7 +293,7 @@
                 salePrice: "",
                 createUser: "",
                 saleBrand: "",
-                
+
                 processName:"",
                 weight:"",
                 type:"1",
@@ -761,10 +761,10 @@
                     })
                     column.dicData = data
                 })
-                
+
             }
         }
-    },    
+    },
     mounted () {
     },
     created () {
@@ -786,7 +786,7 @@
                             type: "warning",
                             message: "销售数量和销售价格不能为负数!"
                         })
-                        done()                        
+                        done()
                     }else{
                         insert(this.form).then(() => {
                             this.onLoad(this.page)
@@ -813,21 +813,29 @@
             this.$refs.form.validate((vaild, done) => {
                 if (vaild) {
                     this.formJG['farmId'] = this.$farmId
-                    submitProcessJG(this.formJG).then(() => {
-                        this.onLoad(this.page)
-                        this.$message({
-                            type: "success",
-                            message: "操作成功!"
-                        })
-                        //提交完成,关闭窗口清空数据
-                        that.cleanJGData()
-                        done()
-                    }, error => {
-                        window.console.log(error)
-                        //提交失败,关闭窗口清空数据
-                        that.cleanJGData()
-                        done()
+                  if(this.formJG.saleNum <0 || this.formJG.processNum<0){
+                    this.$message({
+                      type: "warning",
+                      message: "加工数量和产品数量不能为负数!"
                     })
+                    done()
+                  }else {
+                    submitProcessJG(this.formJG).then(() => {
+                      this.onLoad(this.page)
+                      this.$message({
+                        type: "success",
+                        message: "操作成功!"
+                      })
+                      //提交完成,关闭窗口清空数据
+                      that.cleanJGData()
+                      done()
+                    }, error => {
+                      window.console.log(error)
+                      //提交失败,关闭窗口清空数据
+                      that.cleanJGData()
+                      done()
+                    })
+                  }
                 }
             })
         },
@@ -915,7 +923,7 @@
 
                 this.form.processName = data.processName
                 this.visible = true
-            } else if (index == 1) {    //库存损耗   
+            } else if (index == 1) {    //库存损耗
                 this.formKC.name = this.userInfo.nick_name
                 this.formKC.createUser = this.userInfo.user_id
                 this.formKC.weight = data.productInventoryNum

--
Gitblit v1.9.3