From 22f9e1efd4c77a2c665d2e3e2c84c25e6ae775d4 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期四, 21 十二月 2023 17:07:01 +0800
Subject: [PATCH] 销售明细单 销售机会,销售报价单根据接口获取的配置判断是否必填的功能+按钮禁止点击的样式修改

---
 src/components/makepager/CommonFormTableView.vue |   45 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue
index b8e1f51..70fbd58 100644
--- a/src/components/makepager/CommonFormTableView.vue
+++ b/src/components/makepager/CommonFormTableView.vue
@@ -128,7 +128,17 @@
                   "
                 ></el-input-number>
               </el-form-item>
-              <span v-else>{{ scope.row[item.prop] }}</span>
+              <span v-else>
+                <template v-if="pageName=='quotation'&&item.prop=='profit'">
+                  {{ (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)+'%':'' }}
+                </template>
+                <template v-else>
+                  {{ scope.row[item.prop] }}
+                </template>
+              </span>
             </template>
             <el-form-item
               v-else-if="item.inputNumber && selectBox"
@@ -151,6 +161,15 @@
               ></el-input-number>
             </el-form-item>
             <span v-else style="text-align: right">{{ scope.row[item.prop] }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column  label="鎿嶄綔" width="40" align="center">
+          <template slot-scope="scope">
+            <el-button
+              type="text"
+              size="small"
+              @click="deleteClick(scope)"
+              >鍒犻櫎</el-button>
           </template>
         </el-table-column>
         <slot name="tableButton" />
@@ -199,6 +218,11 @@
     selectBox: {
       type: Boolean,
       default: false
+    },
+    // 閭d釜椤甸潰 鐢ㄦ潵鍒ゆ柇璁$畻鏂瑰紡
+    pageName:{
+      type:String,
+      default:''
     },
     productTableList: {
       type: Object,
@@ -259,7 +283,7 @@
         productName: "",
         productNumber: "",
         page: 1,
-        pageSize: 5
+        pageSize: 100
       }).then((res) => {
         console.log(res, "浜у搧鍚嶇О")
         if (res.code === 200) {
@@ -302,9 +326,13 @@
           sums[index] = "灏忚:"
           return
         }
-        const title = ["#", "浜у搧鍚嶇О"]
+        const title = ["#", "浜у搧鍚嶇О",'浜у搧缂栧彿','鍗曚綅','閿�鍞崟浠�','鎴愭湰鍗曚环']
         // 鍘婚櫎鏌愪簺涓嶉渶瑕佽绠楃殑鏁版嵁
         if (title.includes(column.label)) {
+          sums[index] = ""
+          return
+        }
+        if(this.pageName=='quotation'&&column.label=='姣涘埄'){
           sums[index] = ""
           return
         }
@@ -379,6 +407,13 @@
       this.isRecalculate = false
       this.$emit("emptyProductClick")
     },
+    // 鍒犻櫎
+    deleteClick(scope){
+      this.tableList.tableData.splice(scope.$index,1)
+      this.$forceUpdate();
+      this.$message.success('鍒犻櫎闄ゆ垚鍔燂紒')
+      this.$emit("deleteClick",scope)
+    },
     // 閲嶇畻
     recalculate() {
       this.$confirm("纭畾瑕侀噸绠楁槑缁嗘墍鏈夎?", "鎻愮ず", {
@@ -415,6 +450,7 @@
           ite.number = item.number
           ite.price = item.price
           ite.total = item.amount ? item.amount * item.price : 1 * item.price
+          ite.unit = item.unit
         }
       })
     },
@@ -436,6 +472,7 @@
           ite.number = item.number
           ite.price = item.price
           ite.total = item.amount ? item.amount * item.price : 1 * item.price
+          ite.unit = item.unit
         }
       })
     },
@@ -449,6 +486,7 @@
           ite.number = ""
           ite.price = 0
           ite.total = 0
+          ite.unit = ""
         }
       })
       this.$emit("clearupProduct", this.tableList.tableData)
@@ -471,6 +509,7 @@
 <!-- Add "scoped" attribute to limit CSS to this component only -->
 <style lang="scss" scoped>
 .page-view {
+  
   .el-form-item {
     margin-bottom: 0;
     .custom-name {

--
Gitblit v1.8.0