From 7f5306d896fa0c541a83c4b62d0c533a604dd184 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期日, 28 四月 2024 18:23:23 +0800
Subject: [PATCH] 供应商管理模块 添加新产品的时候供应商对应的产品和已增加的产品都不可选的逻辑处理

---
 src/components/makepager/CommonFormTableView.vue |   73 +++++++++++++++++++++++++++++-------
 1 files changed, 59 insertions(+), 14 deletions(-)

diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue
index 822b967..cfbb18b 100644
--- a/src/components/makepager/CommonFormTableView.vue
+++ b/src/components/makepager/CommonFormTableView.vue
@@ -10,9 +10,9 @@
         :span-method="arraySpanMethod"
         style="width: 100%"
         @selection-change="handleSelectionChange"
-        :row-key="(row) => row.productId"
+        :row-key="getRowKeys"
       >
-        <el-table-column v-if="selectBox"  type="selection" :reserve-selection="true" width="40" align="center">
+        <el-table-column v-if="selectBox"  type="selection" :selectable="isDisabled" :reserve-selection="true" width="40" align="center">
           
         </el-table-column>
         <el-table-column v-if="tableList.isReturn" type="index" label="#" width="50" align="center"></el-table-column>
@@ -36,7 +36,6 @@
           <!-- column鏍峰紡 -->
           <template slot-scope="scope">
             <template v-if="!detailEnter || isOperate">
-              
               <el-form-item
                 v-if="item.input"
                 label=" "
@@ -56,7 +55,12 @@
                 ></el-input>
               </el-form-item>
               <span v-else-if="item.compute">{{ calculateDifference(scope.row) }}</span>
-
+              <!-- 璋冪敤鏂规硶鏄剧ず鏂囧瓧 -->
+              <div v-else-if="item.isCallMethod">
+                <span :class="item.isClass ? item.getClassName(scope.row[item.prop], scope.row) : ''">{{
+                  item.getCallMethod(scope.row[item.prop], scope.row)
+                }}</span>
+              </div>
               <el-form-item
                 v-else-if="item.productName"
                 label=" "
@@ -219,7 +223,7 @@
       v-if="editSelCommonConfig.editVisible"
       :edit-common-config="editSelCommonConfig"
       :sign="sign"
-      :selectBoxList="tableList.tableData"
+      :selectBoxList="arrDisabledList"
       :quotationNumber="quotationNumber"
       @selClient="selClient"
       @getSelectArray="getSelectArray"
@@ -238,6 +242,11 @@
     detailEnter: {
       type: Boolean,
       default: false
+    },
+    // selection 閫夋嫨鐘舵�� 椤甸潰
+    name: {
+      type: String,
+      default: "",
     },
     isBoder:{
       type: Boolean,
@@ -295,20 +304,31 @@
           mergeNumber: 1
         }
       }
+    },
+    disabledList:{
+      type:[Array],
+      default: () => {
+        return []
+      }
     }
   },
   data() {
     return {
       total: 0,
       productList: [],
-      tableList: [],
+      tableList: {
+        tableData:[]
+      },
       editSelCommonConfig: {
         editVisible: false,
         isSelectBox: false,
         title: "",
-        infomation: {}
+        infomation: {},
+        supplierId:null,
       },
-      productIndex: 0
+      productIndex: 0,
+      supplierId:null,
+      arrDisabledList:[]
     }
   },
   created() {
@@ -323,10 +343,34 @@
         this.getTableInfo()
       },
       immediate: true
+    },
+    supplierId(n,o) {  
+      this.editSelCommonConfig.supplierId=n
+      console.log(n,o,"鐪嬬湅閭�") 
+    } ,
+    'tableList.tableData':function () {
+      this.arrDisabledList=this.disabledList.concat(this.tableList.tableData)
     }
   },
   computed: {},
   methods: {
+    // 鑾峰彇row鐨刱ey鍊�
+    getRowKeys(row) {
+      let string;
+      string = row[this.productTableList.key?this.productTableList.key:this.productTableList.productId];
+      return string;
+    },
+    isDisabled(row){ 
+      if (this.name == "rework") {
+        if (row.status == 1) {
+          return true;
+        } else {
+          return false;
+        }
+      }else {
+        return true;
+      }
+    },
     calculateDifference(row) {  
       if (row.notReceiveAmount !== null && row.nowReceiveAmount !== null) {  
         row.surplusReceiveAmount=row.notReceiveAmount - row.nowReceiveAmount;
@@ -340,14 +384,15 @@
     },
     getTableInfo() {
       this.tableList = this.productTableList
+      this.arrDisabledList=this.disabledList.concat(this.tableList.tableData)
     },
     // 浜у搧鍚嶇О
     async getProductList() {
       let fn = this.sign == "purchase" ? getProductList : getProductListFromGrpc
       await fn({
-        page: 1,
-        pageSize: 100
-      }).then((res) => {
+          page: 1,
+          pageSize: 100,
+        }).then((res) => {
         if (res.code === 200) {
           if (res.data.list && res.data.list.length > 0) {
             this.productList = res.data.list
@@ -462,7 +507,7 @@
       }
     },
     commonInputChange(val, prop, row, scope) {
-      if (prop === "amount") {
+      if (prop === "amount"||prop=='purchasePrice') {
         this.tableList.tableData.map((ite) => {
           if (ite.name === row.name) {
             ite.total = row.amount * row.purchasePrice
@@ -521,6 +566,7 @@
       this.tableList.tableData.map((ite) => {
         if (ite.name === item.name) {
           ite.amount = item.amount || 1
+          ite.productId = item.id
           ite.number = item.number
           ite.purchasePrice = item.purchasePrice
           ite.price = item.purchasePrice
@@ -533,8 +579,7 @@
       })
     },
     // 鏂板
-    selClientClick(scope, prop) {
-      console.log(scope, prop)
+    selClientClick(scope) {
       this.productIndex = scope.$index
       this.editSelCommonConfig.title = "浜у搧鍚嶇О"
       this.editSelCommonConfig.isSelectBox = true

--
Gitblit v1.8.0