From 07390e2fcb4adf27c928335bf27ae7939c5a80ad Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 23 五月 2023 11:28:12 +0800
Subject: [PATCH] bakcup20230523

---
 force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js |   73 +++++++++++++++++++++---------------
 1 files changed, 42 insertions(+), 31 deletions(-)

diff --git a/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js
index a662674..81ca3e2 100644
--- a/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js
+++ b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js
@@ -4,6 +4,9 @@
 import saveconfirm from '@salesforce/apex/LexRemoveBoxController.removeBoxConfirm';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 // import { NavigationMixin } from 'lightning/navigation';
+//table css 
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
 
 const columns = [
   {
@@ -11,28 +14,30 @@
     fieldName: 'Name__c',
     wrapText:true,
     hideDefaultActions: true,
-    // initialWidth: 350,
+    initialWidth: 400,
 
   },
   {
     label: '瑙勬牸',
     fieldName: 'ProductPacking_list_manual__c',
     hideDefaultActions: true,
-    // initialWidth: 250,
+    initialWidth: 50,
+    cellAttributes: { alignment: "right" },
+
 
   },
   {
     label: 'CFDA鐘舵��',
     fieldName: 'CFDA_Status__c',
     hideDefaultActions: true,
-    // initialWidth: 250,
+    initialWidth: 200,
 
   },
   {
     label: '娉ㄥ唽璇佺紪鐮佸彿',
     fieldName: 'Report_Product_Approbation__c',
     hideDefaultActions: true,
-    initialWidth: 250,
+    initialWidth: 200,
   },
   {
     label: '娉ㄥ唽璇佹晥鏈�',
@@ -60,6 +65,7 @@
     label: 'BarCode',
     fieldName: 'Bar_Code__c',
     hideDefaultActions: true,
+
    
   }
   ,
@@ -92,7 +98,18 @@
   //鍔犺浇妗�
   @track showSpinner = false
 
-
+  renderedCallback() {
+    if (!this.stylesLoaded) {
+        Promise.all([loadStyle(this, WrappedHeaderTable)])
+            .then(() => {
+                console.log("Custom styles loaded");
+                this.stylesLoaded = true;
+            })
+            .catch((error) => {
+                console.error("Error loading custom styles");
+            });
+    }
+}
 
   //鍒濆鍖�
   connectedCallback() {
@@ -110,13 +127,7 @@
         // this.data = JSON.parse(result.entity.codPageRecords);
         // this.showTable = true;
       } else {
-        console.log('result.msg = ' + result.msg);
-        const evt = new ShowToastEvent({
-          title: '褰曞叆澶辫触',
-          message: result.msg,
-          variant: 'error'
-        });
-        this.dispatchEvent(evt);
+        this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error');
       }
     }).catch((error) => {
       console.log('error = ' + JSON.stringify(error));
@@ -155,12 +166,7 @@
         this.showTable = true;
       } else{
         console.log('result.msg = ' + result.msg);
-        const evt = new ShowToastEvent({
-          title: '鑾峰彇澶辫触',
-          message: result.msg,
-          variant: 'error'
-        });
-        this.dispatchEvent(evt);
+        this.showMyToast('鑾峰彇澶辫触',result.msg,'error');
       }
     }).catch((error) => {
       console.log('error = ' + JSON.stringify(error));
@@ -200,23 +206,12 @@
          this.saveFLGbln = result.entity.saveFLGbln;
         //  this.showSpinner = false;
          if(this.saveFLGbln){
-          const evt = new ShowToastEvent({
-            title: '鎴愬姛',
-            message: result.msg,
-            variant: 'Success'
-          });
-          this.dispatchEvent(evt);
+          this.showMyToast(result.msg,'','success');
           this.showSpinner = false;
-
          }
       } else {
         console.log('result.msg = ' + result.msg);
-        const evt = new ShowToastEvent({
-          title: '澶辫触',
-          message: result.msg,
-          variant: 'error'
-        });
-        this.dispatchEvent(evt);
+        this.showMyToast('鎷嗙洅澶辫触',result.msg,'error');
         this.showSpinner = false;
       }
     })
@@ -226,6 +221,22 @@
 
 
   }
+  showMyToast(title, message, variant) {
+    console.log('show custom message');
+    var iconName = '';
+    var content = '';
+    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>';
+    }
+    this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
+	}
 
 
 

--
Gitblit v1.9.1