From 3303475ef92814062b13e251144b7c03da1d17d8 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期四, 21 十二月 2023 18:34:44 +0800
Subject: [PATCH] 销售明细单如果报价单必填则产品只能选择和报价单关联的,如果报价单非必填则可以选择所有产品

---
 src/components/makepager/CommonFormTableView.vue |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue
index ec70ab3..194cfc0 100644
--- a/src/components/makepager/CommonFormTableView.vue
+++ b/src/components/makepager/CommonFormTableView.vue
@@ -1,6 +1,7 @@
 <template>
   <div class="page-view">
     <el-form ref="form" :model="tableList" :show-message="false" label-position="right">
+      {{ tableList.tableData }}
       <el-table
         ref="fromTable"
         :data="tableList.tableData"
@@ -44,7 +45,7 @@
                   :disabled="!isOperate"
                   @change="
                     (val) => {
-                      commonInputChange(val, item.prop, scope.row)
+                      commonInputChange(val, item.prop, scope.row,scope)
                     }
                   "
                 ></el-input>
@@ -105,7 +106,7 @@
                   style="width: 100%; margin-right: 5px"
                   @change="
                     (val) => {
-                      commonInputChange(val, item.prop, scope.row)
+                      commonInputChange(val, item.prop, scope.row,scope)
                     }
                   "
                 ></el-input-number>
@@ -127,7 +128,7 @@
                   style="width: 100%; margin-right: 5px"
                   @change="
                     (val) => {
-                      commonInputChange(val, item.prop, scope.row)
+                      commonInputChange(val, item.prop, scope.row,scope)
                     }
                   "
                 ></el-input-number>
@@ -137,7 +138,7 @@
                   {{ (scope.row.price&&scope.row.cost)?Number(scope.row.price)-Number(scope.row.cost):'' }}
                 </template>
                 <template v-if="pageName=='quotation'&&item.prop=='margin'">
-                  {{ (scope.row.price&&scope.row.cost)?((Number(scope.row.price)-Number(scope.row.cost))*100/Number(scope.row.cost)).toFixed(2)+'%':'' }}
+                  {{ (scope.row.price&&scope.row.cost)?((Number(scope.row.price)-Number(scope.row.cost))*100/Number(scope.row.cost)).toFixed(2):'' }}
                 </template>
                 <template v-else>
                   {{ scope.row[item.prop] }}
@@ -160,7 +161,7 @@
                 style="width: 100%; margin-right: 5px"
                 @change="
                   (val) => {
-                    commonInputChange(val, item.prop, scope.row)
+                    commonInputChange(val, item.prop, scope.row,scope)
                   }
                 "
               ></el-input-number>
@@ -407,9 +408,7 @@
     add() {
       this.$emit("addProductClick")
     },
-    commonInputChange(val, prop, row) {
-      console.log(val, prop)
-      console.log(row)
+    commonInputChange(val, prop, row,scope) {
       if (prop === "amount") {
         this.tableList.tableData.map((ite) => {
           if (ite.name === row.name) {
@@ -417,6 +416,15 @@
           }
         })
       }
+      if(this.pageName=='quotation'&&prop=='cost'&&scope.row.cost){
+        let value=scope.row.cost
+        let reg2 =
+            /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
+          if (!reg2.test(value)||value==0) {
+            this.$message.error("鎴愭湰鍗曚环闇�瑕佸~鍐欏ぇ浜�0鐨�2浣嶅皬鏁帮紒")
+          } 
+        this.$forceUpdate()
+      }
       this.$emit("inputContent", val, prop, row)
     },
     // 娓呯┖

--
Gitblit v1.8.0