From 5d0b45a82e2452f9f88cfaa958d053405092265c Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期三, 10 四月 2024 17:35:09 +0800
Subject: [PATCH] 1

---
 force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js |   40 ++++++++++++++++++++++++++++++----------
 1 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js b/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js
index ca5380e..7947e06 100644
--- a/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js
+++ b/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js
@@ -1767,13 +1767,19 @@
             }
         }else{
             this.OnLoading(true);
-            setProductEntry(dataChunanshen).then(reslut=>{  
-                debugger        
+            setProductEntry(dataChunanshen).then(reslut=>{       
                 var tempArr=reslut.split("---");
                 var errormessage=tempArr[0];
                 var quoteLineItem=JSON.parse(tempArr[1]);
                 quoteLineItem=InitializeProductAssignment(quoteLineItem);
                 this.jzDataToBeproduct=quoteLineItem;
+                // cjw
+                this.jzDataToBeproduct.forEach(item=>{
+                    idList.push(item.pageObject.PricebookEntry.Product2Id);
+                });
+                addOptions({idList: idList}).then(result=>{
+                    this.addOptionsLogic(result);
+                });
                 if(quoteLineItem.length!=num){
                     this.quo.IsQuoteTrial__c=false;
                 }
@@ -1867,13 +1873,13 @@
             var selectvlue = this.SelectedNewProduct;
             var Listvalue = this.jzDataToBeproduct;
             this.jzDataToBeproduct = additionaljzProductLogic(selectvlue,Listvalue,this.oppInfo.CurrencyIsoCode,this.quo.IsQuoteTrial__c);
-            var jzDataToBeproductStr = JSON.stringify(this.jzDataToBeproduct);
-            addOptions({str: jzDataToBeproductStr}).then(result=>{
-                console.log('before');
-                console.log(jzDataToBeproductStr); 
-                this.jzDataToBeproduct = JSON.parse(result); 
-                console.log('after123123213');
-                console.log(result); 
+            var idList = [];
+            // cjw
+            this.jzDataToBeproduct.forEach(item=>{
+                idList.push(item.pageObject.PricebookEntry.Product2Id);
+            });
+            addOptions({idList: idList}).then(result=>{
+                this.addOptionsLogic(result);
                 if(alertExp){
                     this.Alert(alertExp,'error');
                 }
@@ -1885,9 +1891,23 @@
                 this.cancelProduct();
                 this.SelectedNewProduct = [];
             });
-            
+            // cjw
         }
     }
+    // cjw
+    addOptionsLogic(result){
+        var Setmap = new Map()
+        var key = Object.keys(result)
+        key.forEach(item=>{
+            Setmap.set(item,result[item]);
+        });
+        this.jzDataToBeproduct.forEach(item=>{
+            if(result){
+                item.Learning_CommunityOptions = Setmap.get(item.pageObject.PricebookEntry.Product2Id);
+            }
+        });
+    }
+    // cjw
     //鏂板鎶ヤ环浜у搧妯℃�佹鍙栨秷鎸夐挳
     cancelProduct() {
         this.showproductfalg = false;

--
Gitblit v1.9.1