From 91f850751b85ab0125679a6ea446cbd8a622b46d Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期一, 05 六月 2023 14:38:16 +0800
Subject: [PATCH] LEX Community UpdateComponent

---
 force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js |   90 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 71 insertions(+), 19 deletions(-)

diff --git a/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
index e891918..eeb2a3f 100644
--- a/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
+++ b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
@@ -18,6 +18,7 @@
 //table css 
 import { loadStyle } from "lightning/platformResourceLoader";
 import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+import LexConInvoiceViewReport from '@salesforce/label/c.LexConInvoiceViewReport';
 
 const hospitalColumns = [
     {
@@ -95,6 +96,7 @@
         hideDefaultActions: true,
         wrapText: true,
         cellAttributes: { alignment: 'right' },
+        
         type: "number",
         typeAttributes: {
             minimumFractionDigits: 2,
@@ -159,6 +161,7 @@
         label: "浜у搧鍨嬪彿",
         fieldName: "esdAssetModelNo",
         hideDefaultActions: true,
+        wrapText: true,
     },
     {
         label: "瑙勬牸",
@@ -210,13 +213,13 @@
     },
     {
         label: "寮�绁ㄥ崟浣�",
-        //fieldName: "esdInvoiceUnit",
         hideDefaultActions: true,
         type: "customUnit",
         typeAttributes: {
             unitValue: { fieldName: "unitValue" },
             unitOptions: { fieldName: "unitOptions" },
             recordId: { fieldName: "recordId" },
+            isDisabled: { fieldName: "isDisabled" },
         },
     },
     {
@@ -246,13 +249,18 @@
         fieldName: "invoiceAllprice",
         hideDefaultActions: true,
         type: "number",
+        initialWidth: 150,
         typeAttributes: {
             minimumFractionDigits: 2,
         },
     },
 ]
+const customLabel = {
+    LexConInvoiceViewReport
+}
 export default class LexConInvoiceView extends NavigationMixin(LightningElement) {
 
+    @track label=customLabel;
     invoiceColumns = invoiceColumns;
     detailsColumns = detailsColumns;
     @track outboundColumns = [
@@ -492,8 +500,14 @@
                         this.detailsData[i]['esdInvoicedProcount'] = this.detailsData[i].esd.Invoiced_Procount__c;
                         this.detailsData[i]['esdInvoiceProNotCount'] = this.detailsData[i].esd.InvoiceProNot_count__c;
                         //寮�绁ㄥ崟浣�
-                        this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Invoice_Unit__c;
+                        //this.detailsData[i].esd.Box_Piece__c
+                        //this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Invoice_Unit__c;
+                        this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Box_Piece__c;
+                        console.log('unitValue = ' + this.detailsData[i]['unitValue']);
                         this.detailsData[i]['recordId'] = this.detailsData[i].esd.Id;
+                        //disabled="{!IF(records.esd.Box_Piece__c =='涓�' || (records.esd.Box_Piece__c =='鐩�' && records.Packing_list_manual ==1),true,false)}"
+                        //this.detailsData[i]['isDisabled'] = (this.detailsData[i].esd.Box_Piece__c == '涓�' || (this.detailsData[i].esd.Box_Piece__c =='鐩�' && this.detailsData[i].Packing_list_manual ==1)) ? true:false;
+                        this.detailsData[i]['isDisabled'] = true;
                         let unitOptions = [];
                         for (var key in this.detailsData[i].Invoice_UnitOptsMap) {
                             let unitOption = {};
@@ -580,6 +594,7 @@
                     this.isChange = r.entity.isChange;
                     this.ExistOutbound = r.entity.ExistOutbound;
                     this.outboundData = r.entity.invoiceOrderRecoeds;
+                    console.log('this.outboundData = ' + JSON.stringify(this.outboundData))
                     this.done = r.entity.done;
                     this.accountid = r.entity.accountid;
                     this.userWorkLocation = r.entity.userWorkLocation;
@@ -944,7 +959,22 @@
     SaveJs() {
         this.isShowSpinner = true;
         let cloneData = this.outboundData
+
+        debugger
+        const selectedRows = this.template.querySelector("[data-field='outbound']").getSelectedRows();
+        console.log('selectedRows = ' + JSON.stringify(selectedRows));
+
         for (var i in cloneData) {
+            let b = false;
+            for (var j in selectedRows) {
+                if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
+                    b = true;
+                    cloneData[i].check = true;
+                }
+            }
+            if(!b){
+                cloneData[i].check = false;
+            }
             delete cloneData[i].esdOutboundDate;
             delete cloneData[i].esdNameUrl;
             delete cloneData[i].esdName;
@@ -1205,8 +1235,21 @@
     InvoiceorderSearchJs() {
         this.isShowSpinner = true;
 
+        debugger
         let cloneData = this.outboundData
+        const selectedRows = this.template.querySelector("[data-field='outbound']").getSelectedRows();
+        console.log('selectedRows ' + JSON.stringify(selectedRows));
         for (var i in cloneData) {
+            let b = false;
+            for (var j in selectedRows) {
+                if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
+                    b = true;
+                    cloneData[i].check = true;
+                }
+            }
+            if(!b){
+                cloneData[i].check = false;
+            }
             delete cloneData[i].esdOutboundDate;
             delete cloneData[i].esdNameUrl;
             delete cloneData[i].esdName;
@@ -1226,6 +1269,7 @@
         console.log('this.HospitalInfo = ' + this.HospitalInfo);
         console.log('SecondDealer = ' + this.secondaryDistributor);
         console.log('invoiceOrderRecoedsLwc = ' + JSON.stringify(cloneData));
+
         InvoiceorderSearch({
             cocLwc: this.coc,
             invoiceIdLwc: this.invoiceId,
@@ -1240,8 +1284,14 @@
             console.log("r = " + JSON.stringify(r));
             if (r.status == "Success") {
                 this.outboundData = r.entity.invoiceOrderRecoeds;
+                console.log('this.outboundData = ' + JSON.stringify(this.outboundData));
                 let index = 0;
+                this.selectedRows = [];
                 for (var i in this.outboundData) {
+                    
+                    if(this.outboundData[i].check)
+                        this.selectedRows.push(this.outboundData[i].esd.Id)
+                    this.outboundData[i].Id = this.outboundData[i].esd.Id;
                     this.outboundData[i]['esdOutboundDate'] = this.outboundData[i].esd.Outbound_Date__c;
                     this.outboundData[i]['esdNameUrl'] = '/s/lexsummonscreat?ESetid=' + this.outboundData[i].esd.Id;
                     this.outboundData[i]['esdName'] = this.outboundData[i].esd.Name;
@@ -1287,6 +1337,7 @@
                     //璁$畻鍙戠エ绁ㄩ潰閲戦
                     this.sumPrice += this.outboundData[i].needInvoiceCount;
                 }
+                console.log('this.selectedRows = ' + JSON.stringify(this.selectedRows))
                 this.isShowSpinner = false;
             } else {
                 this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
@@ -1298,20 +1349,20 @@
     }
 
     getSelectedRows(event) {
-        console.log("getSelectedRows ");
-        for (var i in this.outboundData) {
-            this.outboundData[i].check = false;
-        }
-        const selectedRows = event.detail.selectedRows;
-        for (var i in this.outboundData) {
-            for (var j in selectedRows) {
-                if (this.outboundData[i].esd.Id == selectedRows[j].esd.Id) {
-                    //this.outboundData[i].check = !this.outboundData[i].check;
-                    this.outboundData[i].check = true;
-                }
-            }
-        }
-        console.log('this.outboundData = ' + JSON.stringify(this.outboundData));
+        // console.log("getSelectedRows ");
+        // for (var i in this.outboundData) {
+        //     this.outboundData[i].check = false;
+        // }
+        // const selectedRows = event.detail.selectedRows;
+        // for (var i in this.outboundData) {
+        //     for (var j in selectedRows) {
+        //         if (this.outboundData[i].esd.Id == selectedRows[j].esd.Id) {
+        //             //this.outboundData[i].check = !this.outboundData[i].check;
+        //             this.outboundData[i].check = true;
+        //         }
+        //     }
+        // }
+        // console.log('this.outboundData = ' + JSON.stringify(this.outboundData));
     }
 
     deleteButtonJs() {
@@ -1383,9 +1434,10 @@
 
     openReportJs() {
         console.log("openReportJs");
-        //let url = "/report/00O100000058VzB?fv1=" + this.OrderCode;
+        let reportUrl = this.label.LexConInvoiceViewReport;
         let reportFilters = '[{"operator":"equals","value":"' + this.OrderCode + '","column":"FK_NAME"}]';
-        let url = "/report/00O0l000000zaGcEAI?reportFilters=" + encodeURIComponent(reportFilters);
+        console.log('reportUrl = ' + reportUrl);
+        let url = "/report/"+ reportUrl +"?reportFilters=" + encodeURIComponent(reportFilters);
         this[NavigationMixin.Navigate]({
             type: "standard__webPage",
             attributes: {
@@ -1699,7 +1751,7 @@
             contentVersionId: recordId
         }).then(result => {
             if (result.result == 'Success') {
-                this.showMyToast('鎴愬姛', '鍒犻櫎鎴愬姛', 'Success');
+                this.showMyToast('鍒犻櫎鎴愬姛', '', 'Success');
                 if (this.fileData.length == 1)
                     window.location.reload();
                 else

--
Gitblit v1.9.1