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/lexSaleAndDelivery/lexSaleAndDelivery.js |  170 ++++++++++++++++++--------------------------------------
 1 files changed, 54 insertions(+), 116 deletions(-)

diff --git a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
index 0dd889b..0d98bf7 100644
--- a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
+++ b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
@@ -15,7 +15,7 @@
         label: '鍑哄簱鏃�',
         fieldName: 'Outbound_Date__c',
         type: 'date',
-        initialWidth: 100,
+        initialWidth: 130,
         hideDefaultActions: true,
         sortable: true
     },
@@ -31,6 +31,7 @@
             target: '_blank'
         },
         hideDefaultActions: true,
+        initialWidth: 225,
         sortable: true
     },
     {
@@ -87,83 +88,6 @@
         initialWidth: 200
     }
 ];
-
-const editColumns = [
-    {
-        label: '鍑哄簱鏃�',
-        fieldName: 'Outbound_Date__c',
-        type: 'date',
-        hideDefaultActions: true,
-        sortable: true
-    },
-    {
-        label: '鍑哄簱鍗曞彿',
-        fieldName: 'url',
-        type: 'url',
-        typeAttributes: {
-            label: {
-                fieldName: 'Name'
-            },
-            target: '_blank'
-        },
-        hideDefaultActions: true,
-        sortable: true
-    },
-    {
-        label: '瀹㈡埛鍚�',
-        fieldName: 'ShipmentAccount__c',
-        hideDefaultActions: true,
-        sortable: true
-    },
-    {
-        label: '绉戝',
-        fieldName: 'Order_ForCustomerText__c',
-        hideDefaultActions: true
-    },
-    {
-        label: '鍑哄簱鍗曠姸鎬�',
-        fieldName: 'SummonsStatus_c__c',
-        hideDefaultActions: true,
-        sortable: true,
-        initialWidth: 100
-    },
-    {
-        label: '寮�绁ㄧ姸鎬�',
-        fieldName: 'Billed_Status__c',
-        hideDefaultActions: true,
-        sortable: true,
-        initialWidth: 100
-    },
-    {
-        label: '鏈彂绁ㄩ噾棰�(鍏�)',
-        fieldName: 'InvoiceNotPro_money__c',
-        hideDefaultActions: true,
-        initialWidth: 150
-    },
-    {
-        label: '鍒涘缓鏃ユ湡',
-        fieldName: 'CreatedDate',
-        hideDefaultActions: true,
-        sortable: true
-    },
-    // { 
-    //     label: '鍗曚綅', 
-    //     hideDefaultActions: true,
-    //     type:'customUnit',
-    // },
-    // { 
-    //     label: '鍑鸿揣鏁伴噺', 
-    //     hideDefaultActions: true,
-    //     type:'customShipment',
-
-    // },
-    // { 
-    //     label: '鍑鸿揣鍗曚环(鍏�)', 
-    //     hideDefaultActions: true,
-    //     type:'customShipmentUnitPrice',
-
-    // }
-];
 export default class LexSaleAndDelivery extends NavigationMixin(LightningElement) {
     columns = columns;
     @track isShowSpinner = true;
@@ -179,12 +103,26 @@
     @track userWorkLocation = '';
     @track showTable = false;
     @track hidecheckboxcolumn = true;
-    stylesLoaded = false;
 
     //鎺掑簭
     defaultSortDirection = 'asc';
     sortDirection = 'asc';
     sortedBy;
+
+
+    stylesLoaded = 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() {
         init().then((r) => {
@@ -205,26 +143,15 @@
 
             } else {
                 console.log('r = ' + JSON.stringify(r))
-                this.showToast('Error', r.msg);
+                this.showMyToast('鍒濆鍖栧け璐�', r.msg,'Error');
             }
         }).catch((error) => {
             console.log('error = ' + JSON.stringify(error))
+            this.showMyToast('閿欒', '鍒濆鍖栧け璐�','Error');
         })
     }
 
-    renderedCallback() {
-        debugger
-        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");
-                });
-        }
-    }
+
 
     //鏂板缓鍑哄簱鍗�
     neworderhead() {
@@ -258,16 +185,16 @@
                     this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                 }
                 this.message = r.msg;
-                if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟銆�') {
-                    this.showToast('Error', this.message);
+                if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+                    this.showMyToast('鎼滅储澶辫触', this.message,'Error');
                 } else {
-                    this.showToast('Success', this.message);
+                    this.showMyToast('鎼滅储鎴愬姛', this.message,'Success');
                 }
                 this.isShowSpinner = false;
                 //this.isCssLoaded = true
                 this.showTable = true;
             } else {
-                this.showToast('Error', r.msg);
+                this.showMyToast('閿欒',  r.msg,'Error');
             }
         }).catch((error) => {
             console.log('error = ' + JSON.stringify(error))
@@ -298,18 +225,19 @@
                     this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                 }
                 this.message = r.msg;
-                if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟銆�') {
-                    this.showToast('Error', this.message);
+                if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+                    this.showMyToast('鎼滅储澶辫触', this.message,'Error');
                 } else {
-                    this.showToast('Success', this.message);
+                    this.showMyToast('鎼滅储鎴愬姛', this.message,'Success');
                 }
                 this.isShowSpinner = false;
                 this.showTable = true;
             } else {
-                this.showToast('Error', r.msg);
+                this.showMyToast('鎼滅储澶辫触', r.msg,'Error');
             }
         }).catch((error) => {
             console.log('error = ' + JSON.stringify(error))
+            this.showMyToast('鎼滅储澶辫触', '鎼滅储杩樻病鍑哄簱鐨勫嚭搴撳崟鍑洪敊','Error');
         })
     }
 
@@ -335,18 +263,19 @@
                     this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                 }
                 this.message = r.msg;
-                if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟銆�') {
-                    this.showToast('Error', this.message);
+                if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+                    this.showMyToast('鎼滅储澶辫触', this.message,'Error');
                 } else {
-                    this.showToast('Success', this.message);
+                    this.showMyToast('鎼滅储鎴愬姛', this.message,'Success');
                 }
                 this.isShowSpinner = false;
                 this.showTable = true;
             } else {
-                this.showToast('Error', r.msg);
+                this.showMyToast('鎼滅储澶辫触', r.msg,'Error');
             }
         }).catch((error) => {
             console.log('error = ' + JSON.stringify(error))
+            this.showMyToast('鎼滅储澶辫触', '鎼滅储宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗曞嚭閿�','Error');
         })
     }
 
@@ -371,18 +300,19 @@
                     this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                 }
                 this.message = r.msg;
-                if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟銆�') {
-                    this.showToast('Error', this.message);
+                if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+                    this.showMyToast('鎼滅储澶辫触', this.message,'Error');
                 } else {
-                    this.showToast('Success', this.message);
+                    this.showMyToast('鎼滅储鎴愬姛', this.message,'Success');
                 }
                 this.isShowSpinner = false;
                 this.showTable = true;
             } else {
-                this.showToast('Error', r.msg);
+                this.showMyToast('鎼滅储澶辫触', r.msg,'Error');
             }
         }).catch((error) => {
             console.log('error = ' + JSON.stringify(error))
+            this.showMyToast('鎼滅储澶辫触', '鎼滅储澶辫触','Error');
         })
     }
 
@@ -455,14 +385,22 @@
         });
     }
 
-    showToast(type, msg) {
+    showMyToast(title, message, variant) {
         this.isShowSpinner = false;
-        const event = new ShowToastEvent({
-            title: type,
-            variant: type,
-            message: msg
-        });
-        this.dispatchEvent(event);
+        console.log('show custom message');
+        var iconName = '';
+        var content = '';
+        if (variant.toLowerCase() == '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);
     }
 
     @track isModalOpen = false;

--
Gitblit v1.9.1