From a06ae1535ed13403aee2805e21a5adbf3938ed78 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 26 五月 2023 15:01:56 +0800
Subject: [PATCH] signoff backup 0526

---
 force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js |  100 +++++++++++++++++++++++++++++++------------------
 1 files changed, 63 insertions(+), 37 deletions(-)

diff --git a/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js b/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js
index c2b5fd7..db4e6a3 100644
--- a/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js
+++ b/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js
@@ -3,12 +3,16 @@
 import init from "@salesforce/apex/LexOutboundorderImportController.init";
 import importCSVFile from "@salesforce/apex/LexOutboundorderImportController.importCSVFile";
 import dataImport from "@salesforce/apex/LexOutboundorderImportController.dataImport";
+//table css 
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
 
 const columns = [
     {
         label: "鍑哄簱鍗曞悕绉�",
         fieldName: "orderName",
         hideDefaultActions: true,
+        initialWidth: 200
     },
     {
         label: "鐩殑",
@@ -24,6 +28,7 @@
         label: "鍖婚櫌鍚嶇О",
         fieldName: "hospitalName",
         hideDefaultActions: true,
+        initialWidth: 300
     },
     {
         label: "绉戝",
@@ -86,27 +91,40 @@
     @track secondAgencyMap = {};
     @track hospitalSysMap = {};
 
+    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) => {
-                r = JSON.parse(JSON.stringify(r));
+            r = JSON.parse(JSON.stringify(r));
+            console.log("r = " + JSON.stringify(r));
+            if (r.status == "Success") {
+                this.accountid = r.entity.accountid;
+                this.userWorkLocation = r.entity.userWorkLocation;
+                this.agencyProType = r.entity.agencyProType;
+                console.log('this.agencyProType = ' + this.agencyProType);
+                this.accountName = r.entity.accountName;
+                this.sqlagencyProType = r.entity.sqlagencyProType;
+                this.isShowSpinner = false;
+            } else {
                 console.log("r = " + JSON.stringify(r));
-                if (r.status == "Success") {
-                    this.accountid = r.entity.accountid;
-                    this.userWorkLocation = r.entity.userWorkLocation;
-                    this.agencyProType = r.entity.agencyProType;
-                    console.log('this.agencyProType = '  +  this.agencyProType);
-                    this.accountName = r.entity.accountName;
-                    this.sqlagencyProType = r.entity.sqlagencyProType;
-                    this.isShowSpinner = false;
-                } else {
-                    console.log("r = " + JSON.stringify(r));
-                    this.showToast("Error", r.msg);
-                }
-            })
-            .catch((error) => {
-                console.log("error = " + JSON.stringify(error));
-                this.showToast("Error", error.message);
-            });
+                this.showMyToast('鍒濆鍖栧け璐�', r.msg, 'Error')
+            }
+        }).catch((error) => {
+            console.log("error = " + JSON.stringify(error));
+            this.showMyToast('閿欒', '鍒濆鍖栧け璐�', 'Error')
+        });
     }
 
     getCsvFile() {
@@ -132,7 +150,7 @@
             this.fileReader.readAsDataURL(this.file);
         } else {
             this.fileName = "閫夋嫨涓�涓猚sv鏂囦欢涓婁紶";
-            this.showToast("Error", '閫夋嫨涓�涓猚sv鏂囦欢涓婁紶');
+            this.showMyToast('涓婁紶澶辫触', '閫夋嫨涓�涓猚sv鏂囦欢涓婁紶', 'Error')
         }
     }
 
@@ -173,15 +191,15 @@
                     this.data[i]['orderOrderForCustomerText'] = this.data[i].order.Order_ForCustomerText__c;
                     this.data[i]['orderOutboundDate'] = this.data[i].order.Outbound_Date__c;
                 }
-                this.showToast("Error", r.msg);
+                this.showMyToast('瀵煎叆澶辫触', r.msg, 'Error')
             } else {
                 console.log("r.msg = " + JSON.stringify(r.msg));
-                this.showToast("Error", r.msg);
+                this.showMyToast('瀵煎叆澶辫触', r.msg, 'Error')
             }
         }).catch((error) => {
-                console.log("error = " + JSON.stringify(error.message));
-                this.showToast("Error", error.message);
-            });
+            console.log("error = " + JSON.stringify(error.message));
+            this.showMyToast('瀵煎叆閿欒', '瀵煎叆澶辫触', 'Error')
+        });
     }
 
     dataImport() {
@@ -210,18 +228,18 @@
             if (r.status == "Success" && r.msg == "") {
                 this.saveFLGbln = true;
                 console.log("dataImport success");
-                this.showToast("Success", '淇濆瓨鎴愬姛');
+                this.showMyToast('鎴愬姛', '淇濆瓨鎴愬姛', 'Success')
             } else if (r.msg != "") {
                 console.log("r.msg = " + JSON.stringify(r.msg));
-                this.showToast("Error", r.msg);
+                this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error')
             } else {
                 console.log("r.msg = " + JSON.stringify(r.msg));
-                this.showToast("Error", r.msg);
+                this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error')
             }
         }).catch((error) => {
-                console.log("error = " + JSON.stringify(error.message));
-                this.showToast("Error", error.message);
-            });
+            console.log("error = " + JSON.stringify(error.message));
+            this.showMyToast('閿欒', '淇濆瓨澶辫触', 'Error')
+        });
     }
 
     handleFilesChange(event) {
@@ -232,13 +250,21 @@
         }
     }
 
-    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);
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1