From 5b5c1e16deaa3a9d6d0ed1ffca390655ed103df7 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 14:56:14 +0800
Subject: [PATCH] lex community

---
 force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js |  298 ++++++++++++++++++++---------------------------------------
 1 files changed, 101 insertions(+), 197 deletions(-)

diff --git a/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js b/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js
index 20bef77..30c135b 100644
--- a/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js
+++ b/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js
@@ -1,17 +1,16 @@
-import { LightningElement, wire, track } from 'lwc';
+import { LightningElement,wire,track } from 'lwc';
 import { CurrentPageReference } from 'lightning/navigation';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import { NavigationMixin } from 'lightning/navigation';
 import init from '@salesforce/apex/LexArriveGsDetailsController.init';
 import proSale from '@salesforce/apex/LexArriveGsDetailsController.proSale';
 import helpText from '@salesforce/label/c.LexArrivegsDetailsPageHelpText';
-//table css
-import { loadStyle } from 'lightning/platformResourceLoader';
-import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
+//table css 
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
 
-export default class LexArriveGsDetails extends NavigationMixin(
-    LightningElement
-) {
+export default class LexArriveGsDetails extends NavigationMixin(LightningElement) {
+
     @track eSetId;
     @track showSpinner = true;
     @track showPage = false;
@@ -25,67 +24,16 @@
     //鏄惁涓�鐩存樉绀烘彁绀�
     @track isNoteStay = true;
     @track colms = [
-        {
-            label: '娑堣�楀搧鍚嶇О',
-            fieldName: 'prodName',
-            hideDefaultActions: true,
-            wrapText: true
-        },
-        {
-            label: '瑙勬牸',
-            fieldName: 'packing_list',
-            hideDefaultActions: true,
-            wrapText: true,
-            initialWidth: 50,
-            cellAttributes: { alignment: 'right' }
-        },
-        {
-            label: 'CFDA鐘舵��',
-            fieldName: 'statusCFDA',
-            hideDefaultActions: true,
-            wrapText: true,
-            initialWidth: 100
-        },
-        {
-            label: '娉ㄥ唽璇佺紪鐮佸彿',
-            fieldName: 'approbation_No',
-            hideDefaultActions: true,
-            wrapText: true,
-            initialWidth: 125
-        },
-        {
-            label: '娉ㄥ唽璇佹晥鏈�',
-            fieldName: 'expiration_DateStr',
-            hideDefaultActions: true,
-            wrapText: true,
-            initialWidth: 115
-        },
-        {
-            label: '浣跨敤鏈熼檺',
-            fieldName: 'Sterilization_limitStr',
-            hideDefaultActions: true,
-            wrapText: true,
-            initialWidth: 115
-        },
-        {
-            label: 'BarCode',
-            fieldName: 'barCode',
-            hideDefaultActions: true,
-            initialWidth: 250,
-            wrapText: true
-        },
-        {
-            label: '閲囪喘鍗曚环',
-            type: 'number',
-            fieldName: 'intraTradeList',
-            hideDefaultActions: true,
-            wrapText: true,
-            initialWidth: 120,
-            typeAttributes: { minimumFractionDigits: 2 },
-            cellAttributes: { alignment: 'right' }
-        }
+        {label:'娑堣�楀搧鍚嶇О' , fieldName:'prodName', hideDefaultActions: true,wrapText:true},
+        {label:'瑙勬牸' , fieldName:'packing_list', hideDefaultActions: true,wrapText:true,initialWidth:50,cellAttributes: { alignment: "right" }},
+        {label:'CFDA鐘舵��' , fieldName:'statusCFDA', hideDefaultActions: true,wrapText:true,initialWidth:100},
+        {label:'娉ㄥ唽璇佺紪鐮佸彿' , fieldName:'approbation_No', hideDefaultActions: true,wrapText:true,initialWidth:125},
+        {label:'娉ㄥ唽璇佹晥鏈�' , fieldName:'expiration_DateStr', hideDefaultActions: true,wrapText:true,initialWidth:115},
+        {label:'浣跨敤鏈熼檺' , fieldName:'Sterilization_limitStr', hideDefaultActions: true,wrapText:true,initialWidth:115},
+        {label:'BarCode' , fieldName:'barCode', hideDefaultActions: true,initialWidth:250,wrapText:true},
+        {label:'閲囪喘鍗曚环' ,type:'number',fieldName:'intraTradeList', hideDefaultActions: true,wrapText:true,initialWidth:120,typeAttributes:{minimumFractionDigits: 2},cellAttributes: { alignment: "right" }}
     ];
-    label = { helpText };
+    label = {helpText};
 
     // 鑾峰彇鍙傛暟
     @wire(CurrentPageReference)
@@ -93,145 +41,107 @@
         if (currentPageReference) {
             this.eSetId = currentPageReference.state?.EsetId;
         }
-        console.log('CurrentPageReference:' + this.eSetId);
+        console.log('CurrentPageReference:'+this.eSetId);
     }
 
-    renderedCallback() {
+    renderedCallback(){ 
         if (!this.stylesLoaded) {
             Promise.all([loadStyle(this, WrappedHeaderTable)])
                 .then(() => {
-                    console.log('Custom styles loaded');
+                    console.log("Custom styles loaded");
                     this.stylesLoaded = true;
                 })
                 .catch((error) => {
-                    console.error('Error loading custom styles');
+                    console.error("Error loading custom styles");
                 });
         }
     }
 
     //鍒濆鍖�
-    connectedCallback() {
-        init({ eSetIdStr: this.eSetId })
-            .then((result) => {
-                this.showPage = true;
-                this.isNoteStay = result.isNoteStay;
-                if (result.result == 'Success') {
-                    this.coc = result.coc;
-                    if (
-                        this.coc.Arrive_Order__c != null &&
-                        this.coc.Arrive_Order__c != ''
-                    ) {
-                        this.coc['arriveOrder'] = this.coc.Arrive_Order__r.Name;
-                    }
-                    console.log('this.coc:' + JSON.stringify(this.coc));
-                    this.accountid = result.accountid;
-                    this.orderallcount = result.orderallcount;
-                    this.arrivetoorder = result.arrivetoorder;
-                    this.consumableorderdetailsCount =
-                        result.consumableorderdetailsCount;
-                    this.consumableorderdetailsRecords =
-                        result.consumableorderdetailsRecords;
-                    for (var i in this.consumableorderdetailsRecords) {
-                        if (this.consumableorderdetailsRecords[i].esd != null) {
-                            this.consumableorderdetailsRecords[i]['recordId'] =
-                                this.consumableorderdetailsRecords[i].esd.Id;
-                            if (
-                                this.consumableorderdetailsRecords[i].esd
-                                    .Consumable_Product__c != null &&
-                                this.consumableorderdetailsRecords[i].esd
-                                    .Consumable_Product__c != ''
-                            ) {
-                                this.consumableorderdetailsRecords[i][
-                                    'prodName'
-                                ] =
-                                    this.consumableorderdetailsRecords[
-                                        i
-                                    ].esd.Consumable_Product__r.Name__c;
-                            }
-                            // this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].prodName;
-                            this.consumableorderdetailsRecords[i]['barCode'] =
-                                this.consumableorderdetailsRecords[
-                                    i
-                                ].esd.Bar_Code__c;
-                            this.consumableorderdetailsRecords[i][
-                                'intraTradeList'
-                            ] =
-                                this.consumableorderdetailsRecords[
-                                    i
-                                ].esd.Intra_Trade_List_RMB__c;
-                            console.log(
-                                'Intra_Trade_List_RMB__c:' +
-                                    this.consumableorderdetailsRecords[i].esd
-                                        .Intra_Trade_List_RMB__c
-                            );
-                        }
-                        if (
-                            this.consumableorderdetailsRecords[i].Prod != null
-                        ) {
-                            this.consumableorderdetailsRecords[i][
-                                'statusCFDA'
-                            ] =
-                                this.consumableorderdetailsRecords[
-                                    i
-                                ].Prod.SFDA_Status__c;
-                        }
-                    }
-                    this.showSpinner = false;
-                } else {
-                    this.showSpinner = false;
-                    console.log('error:' + result.errorMsg);
-                    this.showMyToast('鍒濆鍖栧け璐�', result.errorMsg, 'error');
+    connectedCallback(){
+        init({eSetIdStr : this.eSetId})
+        .then(result=>{
+            this.showPage = true;
+            this.isNoteStay = result.isNoteStay;
+            if(result.result == 'Success'){
+                this.coc = result.coc;
+                if(this.coc.Arrive_Order__c != null && this.coc.Arrive_Order__c != ''){
+                    this.coc['arriveOrder'] = this.coc.Arrive_Order__r.Name;
                 }
-            })
-            .catch((error) => {
+                console.log('this.coc:'+JSON.stringify(this.coc));
+                this.accountid = result.accountid;
+                this.orderallcount = result.orderallcount;
+                this.arrivetoorder = result.arrivetoorder;
+                this.consumableorderdetailsCount = result.consumableorderdetailsCount;
+                this.consumableorderdetailsRecords = result.consumableorderdetailsRecords;
+                for(var i in this.consumableorderdetailsRecords){
+                    if(this.consumableorderdetailsRecords[i].esd != null){
+                        this.consumableorderdetailsRecords[i]['recordId'] = this.consumableorderdetailsRecords[i].esd.Id;
+                        if(this.consumableorderdetailsRecords[i].esd.Consumable_Product__c != null && this.consumableorderdetailsRecords[i].esd.Consumable_Product__c != ''){
+                            this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].esd.Consumable_Product__r.Name__c;
+                        }
+                        // this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].prodName;
+                        this.consumableorderdetailsRecords[i]['barCode'] = this.consumableorderdetailsRecords[i].esd.Bar_Code__c;
+                        this.consumableorderdetailsRecords[i]['intraTradeList'] = this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c;
+                        console.log("Intra_Trade_List_RMB__c:"+this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c);
+                    }
+                    if(this.consumableorderdetailsRecords[i].Prod != null){
+                        this.consumableorderdetailsRecords[i]['statusCFDA'] = this.consumableorderdetailsRecords[i].Prod.SFDA_Status__c;
+                    }
+                }
                 this.showSpinner = false;
-                this.showPage = true;
-                console.log('error:' + error);
-                this.showMyToast('鍒濆鍖栧け璐�', error, 'error');
-            });
+            }else {
+                this.showSpinner = false;
+                console.log("error:"+result.errorMsg);
+                this.showMyToast('鍒濆鍖栧け璐�',result.errorMsg,'error');
+            }
+        })
+        .catch(error=>{
+            this.showSpinner = false;
+            this.showPage = true;
+            console.log("error:"+error);
+            this.showMyToast('鍒濆鍖栧け璐�',error,'error');
+        })
     }
 
-    proSale() {
+    proSale(){
         this.showSpinner = true;
         proSale({
-            cocStr: JSON.stringify(this.coc),
-            orderallcountParm: this.orderallcount,
-            consumableorderdetailsCountParm: this.consumableorderdetailsCount,
-            eSetIdStr: this.eSetId
+            cocStr : JSON.stringify(this.coc),
+            orderallcountParm : this.orderallcount,
+            consumableorderdetailsCountParm : this.consumableorderdetailsCount,
+            eSetIdStr : this.eSetId
         })
-            .then((result) => {
-                if (result.result == 'Success') {
-                    var url = result.url;
-                    const config = {
-                        type: 'standard__webPage',
-                        attributes: {
-                            url: url
-                        }
-                    };
-                    this[NavigationMixin.Navigate](config);
-                } else {
-                    this.showSpinner = false;
-                    console.log('error:' + result.errorMsg);
-                    this.showMyToast('鍑哄簱澶辫触', result.errorMsg, 'error');
-                }
-            })
-            .catch((error) => {
-                this.showPage = true;
+        .then(result=>{
+            if(result.result == 'Success'){
+                var url = result.url;
+                const config = {
+                    type: 'standard__webPage',
+                    attributes: {
+                       url: url
+                    }
+                };
+                this[NavigationMixin.Navigate](config);
+            }else {
                 this.showSpinner = false;
-                console.log('error:' + error);
-                this.showMyToast('鍑哄簱澶辫触', error, 'error');
-            });
+                console.log("error:"+result.errorMsg);
+                this.showMyToast('鍑哄簱澶辫触',result.errorMsg,'error');
+            }
+        })
+        .catch(error=>{
+            this.showPage = true;
+            this.showSpinner = false;
+            console.log("error:"+error);
+            this.showMyToast('鍑哄簱澶辫触',error,'error');
+        })
     }
 
-    clickOrder() {
-        if (
-            this.coc.Arrive_Order__c != null &&
-            this.coc.Arrive_Order__c != ''
-        ) {
+    clickOrder(){
+        if(this.coc.Arrive_Order__c != null && this.coc.Arrive_Order__c != ''){
             const config = {
                 type: 'standard__webPage',
                 attributes: {
-                    url: '/detail/' + this.coc.Arrive_Order__c
+                   url: '/detail/'+this.coc.Arrive_Order__c
                 }
             };
             this[NavigationMixin.Navigate](config);
@@ -242,24 +152,18 @@
         console.log('show custom message');
         var iconName = '';
         var content = '';
-        if (variant == 'success') {
-            iconName = 'utility:check';
-        } else {
-            iconName = 'utility:error';
+        if(variant == 'success'){
+           iconName = 'utility:check';
+        }else{
+           iconName = 'utility:error';
         }
-        if (message != '') {
-            content =
-                '<h2><strong>' +
-                title +
-                '<strong/></h2><h5>' +
-                message +
-                '</h5>';
-        } else {
-            content = '<h2><strong>' + title + '<strong/></h2>';
+        if(message != ''){
+           content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+        }else{
+           content = '<h2><strong>'+title+'<strong/></h2>';
         }
-        this.template
-            .querySelector('c-common-toast')
-            .showToast(variant, content, iconName, 10000);
+        this.template.querySelector('c-common-toast').
+        showToast(variant,content,iconName,10000);
         // var mode;
         // if(this.isNoteStay){
         //     mode ='sticky';
@@ -273,5 +177,5 @@
         //     mode: mode
         // });
         // this.dispatchEvent(evt);
-    }
+     }
 }
\ No newline at end of file

--
Gitblit v1.9.1