From 71b93327e8f3fb3bffffc7c033c1f782e7b6ab32 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期一, 22 五月 2023 17:37:16 +0800
Subject: [PATCH] test

---
 force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js |   80 +++++++++++++++++++++++++++++++++------
 1 files changed, 67 insertions(+), 13 deletions(-)

diff --git a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
index e3c946b..dae0395 100644
--- a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
+++ b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
@@ -4,11 +4,11 @@
  * @Author: chen jing wu
  * @Date: 2023-04-20 15:04:03
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-28 17:33:23
+ * @LastEditTime: 2023-05-05 11:01:42
  */
 const columns=[
-    { "label" : "澶卞崟鍝佺墝", "apiName" : "LostBrandName__c" ,"fieldType":"picklist","objectName":"PCLLostProduct__c"}, 
-    { "label" : "澶卞崟瀵规墜鍨嬪彿", "apiName" : "LostProduct__c" ,"fieldType":"lookup","objectName":"PCLLostProduct__c"},
+    { "label" : "澶卞崟鍝佺墝", "apiName" : "LostBrandName__c" ,"fieldType":"picklist","objectName":"PCLLostProduct__c", "readOnly":true,"value":"--鏃�--"}, 
+    { "label" : "澶卞崟瀵规墜鍨嬪彿", "apiName" : "LostProduct__c" ,"fieldType":"lookup","objectName":"PCLLostProduct__c","disable":"false"},
     { "label" : "澶卞崟鏁伴噺", "apiName" : "Quantity__c","fieldType":"text","objectName":"PCLLostProduct__c" },
     { "label" : "澶卞崟瀵规墜鍨嬪彿(鎵嬪姩)", "apiName" : "LostProductMannual__c","fieldType":"text","objectName":"PCLLostProduct__c" },
     { "label" : "澶卞崟浜у搧绫诲埆", "apiName" : "ProductClass__c","fieldType":"picklist","objectName":"PCLLostProduct__c" },
@@ -35,6 +35,7 @@
 import setbrand from '@salesforce/apex/lexPCLLostReportLwcController.setBrand';
 import init from '@salesforce/apex/lexPCLLostReportLwcController.init';
 import multiSelectCombobox from 'c/multiSelectCombobox'
+import lexMultiSelectCombobox from 'c/lexmultiSelectCombobox';
 import searchBrands from '@salesforce/apex/lexPCLLostReportLwcController.searchBrands';
 import getNewLostBrand from '@salesforce/apex/lexPCLLostReportLwcController.getNewLostBrand';
 import getLostReport from '@salesforce/apex/lexPCLLostReportLwcController.getLostReport';
@@ -43,9 +44,11 @@
 
     @track records;
     @api recordJson;
-    @track columns=columns;
+    // @track columns=columns;
     @track columns2=columns2;
     @api reasonValue;
+    @track columnsArr = [columns];
+    @track columns = columns;
     oppId = '0061000001R2xjWAAR';
     lostReportId = '';
     pageStatus = 'Create';
@@ -53,8 +56,10 @@
     submitFlag = '';
     searchResult;
     brandsCount = [""];
+    columnsArrIndex = 0;
     @track LostReport = {
-        LostBrands: [],
+        LostBrands: [
+        ],
         lostReport: {}
     };
     @track brandOptions = [];
@@ -93,12 +98,22 @@
             // const div = this.template.querySelector('[data-Id="initDiv"]');
             // console.log(success);
             // div.classList.add("mynewclass");
+            this.LostReport.LostBrands[0].columns = columns;
+            console.log(this.LostReport);
             const multiCombobox = this.template.querySelector('c-multi-select-combobox');
             multiCombobox.refreshOptions(this.brandOptions);
         }).catch(error=>{
             console.log("error");
             console.log(error);
         });
+    }
+
+    get isInit(){
+        if(this.LostReport.LostBrands.length == 0){
+            return false
+        }else{
+            return true;
+        }
     }
 
     
@@ -153,7 +168,6 @@
     //         });
     //     });
     // }
-    
 
     getParamValue(paramName) {
         // Use the URLSearchParams API to get the value of a query parameter
@@ -173,7 +187,9 @@
             lineNo: this.LostReport.LostBrands.length
         }).then(result=>{
             this.LostReport.LostBrands.push(result);
-        })
+            this.LostReport.LostBrands[this.LostReport.LostBrands - 1].columns = columns;
+            // this.columnsArr.push(columns);
+        });
     }
     submitJS() {
         submit().then(result=>{
@@ -218,8 +234,13 @@
 
     deleteBrandJs(event){
         var str = event.target.name;
+        this.columnsArrIndex = 0;
         this.LostReport.LostBrands.splice(str,1);
         console.log(this.LostReport);
+    }
+
+     getMutiboxName(index){
+        return `mutibox${index}`; 
     }
     
     // add tcm 20211118 end
@@ -259,25 +280,41 @@
         });
     }
     setBrandMannualName(event) {
-        var set = event;
-        console.log(set);
+        var index = event.target.name;
+        const payload = event.detail.payload;
+        const payloadType = event.detail.payloadType;
+        if(payloadType === 'multi-select'){
+            this.setDefaultBrand(payload.value,index);
+            this.clearBrandMannualName(payload.value,index);
+        }
     }
+    setDefaultBrand(value,index){
+        console.log("123");
+        this.columnsArr[index][0].value = value;
+        this.columns[0].value = value;
+    }
+
    
     // 澶卞崟鍝佺墝涓嶇瓑浜庡叾浠栨椂,澶卞崟鍝佺墝锛堟墜鍔級娓呯┖骞朵笖涓嶅厑璁稿~鍐�,澶卞崟鍝佺墝绛変簬鍏朵粬鏃�,澶卞崟瀵规墜鍨嬪彿涓嶅彲鐢�  thh 2022-01-13 start
-    clearBrandMannualName(value){
+    clearBrandMannualName(value,index){
         if (value == '鍏朵粬') {
             // this.template.querySelector('[data-id="LostProduct"]').setAttribute('disabled', true);
-            this.template.querySelector('[data-id="LostProduct"]]').disabled = true;
+            this.template.querySelector('[data-id="Lost_By_Company_Mannual"][name='+ index +']').disabled = false;
+            // this.columns[1].disable = true;
+            this.columnsArr[index][1].disable = true; 
             console.log("213");
         } else {
             console.log("5435");
-            this.template.querySelector('[data-id="Lost_By_Company_Mannual"]').value = '';
+            this.template.querySelector('[data-id="Lost_By_Company_Mannual"][name='+ index +']').value = '';
             // this.template.querySelector('[data-id="Lost_By_Company_Mannual"]').setAttribute('disabled', true);
-            this.template.querySelector('[data-id="Lost_By_Company_Mannual"]').disabled = true;
+            this.template.querySelector('[data-id="Lost_By_Company_Mannual"][name='+ index +']').disabled = true;
+            // this.columns[1].disable = false;
+            this.columnsArr[index][1].disable = false; 
         }
     }
     cancel() {
         // Navigate to the specified opportunity page using the NavigationMixin
+        console.log("321");
         this[NavigationMixin.Navigate]({
             type: 'standard__recordPage',
             attributes: {
@@ -298,5 +335,22 @@
     handleStatus1Change(){
         
     }
+    handleBrandChange(value){
+        
+    }
+
+    handleButtonClick() {
+        var table = this.template.querySelector("c-lex-dynamic-table");
+        
+        console.log("end");
+        if(table!=undefined)
+        {
+            var records = table.retrieveRecords();
+            for(i=0;i < records.length;i++){
+                this.LostReport.LostBrands[0].LostProducts
+            }
+        }
+        
+      }
     
 }
\ No newline at end of file

--
Gitblit v1.9.1