From 80a3f59e2d3df07805bc67e329300b8de90a5b3a Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 11 七月 2023 14:13:08 +0800
Subject: [PATCH] Merge branch 'LEXCommunityLiJun' into LEXUpgrade2023-Deloitte

---
 force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js |  291 +++++++++++++++++++++++++++++++--------------------------
 1 files changed, 157 insertions(+), 134 deletions(-)

diff --git a/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js b/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js
index 0200238..669ce79 100644
--- a/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js
+++ b/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js
@@ -1,78 +1,78 @@
-import { LightningElement, api, track, wire } from "lwc";
-import { ShowToastEvent } from "lightning/platformShowToastEvent";
-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";
+import { LightningElement, api, track, wire } from 'lwc';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+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",
+        label: '鍑哄簱鍗曞悕绉�',
+        fieldName: 'orderName',
         hideDefaultActions: true,
         initialWidth: 200,
-        wrapText: true,
+        wrapText: true
     },
     {
-        label: "鐩殑",
-        fieldName: "orderSummonsForDirction",
+        label: '鐩殑',
+        fieldName: 'orderSummonsForDirction',
         hideDefaultActions: true,
-        wrapText: true,
+        wrapText: true
     },
     {
-        label: "鍖婚櫌缂栫爜",
-        fieldName: "hospitalCode",
+        label: '鍖婚櫌缂栫爜',
+        fieldName: 'hospitalCode',
         hideDefaultActions: true,
-        wrapText: true,
+        wrapText: true
     },
     {
-        label: "鍖婚櫌鍚嶇О",
-        fieldName: "hospitalName",
+        label: '鍖婚櫌鍚嶇О',
+        fieldName: 'hospitalName',
         hideDefaultActions: true,
         wrapText: true,
         initialWidth: 300
     },
     {
-        label: "绉戝",
-        fieldName: "orderOrderForCustomerText",
+        label: '绉戝',
+        fieldName: 'orderOrderForCustomerText',
         hideDefaultActions: true,
-        wrapText: true,
+        wrapText: true
     },
     {
-        label: "浜岀骇缁忛攢鍟�",
-        fieldName: "agencyName",
+        label: '浜岀骇缁忛攢鍟�',
+        fieldName: 'agencyName',
         hideDefaultActions: true,
-        wrapText: true,
+        wrapText: true
     },
     {
-        label: "鍑哄簱/閿�鍞棩鏈�",
-        fieldName: "orderOutboundDate",
+        label: '鍑哄簱/閿�鍞棩鏈�',
+        fieldName: 'orderOutboundDate',
         hideDefaultActions: true,
-        wrapText: true,
-    },
+        wrapText: true
+    }
 ];
 export default class LexOutboundorderImport extends LightningElement {
     @track isShowSpinner = true;
     //鏂囦欢涓婁紶
     @track showLoadingSpinner = false;
-    @track UploadFile = "Upload File";
-    @track fileName = "";
+    @track UploadFile = 'Upload File';
+    @track fileName = '';
     @track fileData = [];
     @track fileColumns = [
         {
-            label: "鏍囬",
-            fieldName: "url",
-            type: "url",
-            typeAttributes: { label: { fieldName: "Title" }, target: "_blank" },
-            hideDefaultActions: true,
+            label: '鏍囬',
+            fieldName: 'url',
+            type: 'url',
+            typeAttributes: { label: { fieldName: 'Title' }, target: '_blank' },
+            hideDefaultActions: true
         },
         {
-            label: "鍒涘缓浜�",
-            fieldName: "CreatedByName",
-            hideDefaultActions: true,
-        },
+            label: '鍒涘缓浜�',
+            fieldName: 'CreatedByName',
+            hideDefaultActions: true
+        }
     ];
     filesUploaded = [];
     fileContents;
@@ -80,7 +80,7 @@
     content;
     MAX_FILE_SIZE = 1500000;
     get acceptedType() {
-        return [".csv"];
+        return ['.csv'];
     }
 
     //鍒楄〃
@@ -88,11 +88,11 @@
     @track data = [];
 
     //鏁版嵁
-    @track accountid = "";
-    @track userWorkLocation = "";
-    @track agencyProType = "";
-    @track accountName = "";
-    @track sqlagencyProType = "";
+    @track accountid = '';
+    @track userWorkLocation = '';
+    @track agencyProType = '';
+    @track accountName = '';
+    @track sqlagencyProType = '';
     @track csvRecordStr = [];
     @track saveFLGbln = false;
     @track secondAgencyMap = {};
@@ -103,35 +103,37 @@
         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().then((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));
-                this.showMyToast('鍒濆鍖栧け璐�', r.msg, 'Error')
-            }
-        }).catch((error) => {
-            console.log("error = " + JSON.stringify(error));
-            this.showMyToast('閿欒', '鍒濆鍖栧け璐�', 'Error')
-        });
+        init()
+            .then((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));
+                    this.showMyToast('鍒濆鍖栧け璐�', r.msg, 'Error');
+                }
+            })
+            .catch((error) => {
+                console.log('error = ' + JSON.stringify(error));
+                this.showMyToast('閿欒', '鍒濆鍖栧け璐�', 'Error');
+            });
     }
 
     getCsvFile() {
@@ -140,7 +142,7 @@
         if (this.filesUploaded.length > 0) {
             this.file = this.filesUploaded[0];
             if (this.file.size > this.MAX_FILE_SIZE) {
-                window.console.log("鏂囦欢杩囧ぇ");
+                window.console.log('鏂囦欢杩囧ぇ');
                 this.isShowSpinner = false;
                 return;
             }
@@ -148,66 +150,78 @@
 
             this.fileReader.onloadend = () => {
                 this.fileContents = this.fileReader.result;
-                let base64 = "base64,";
-                this.content = this.fileContents.indexOf(base64) + base64.length;
+                let base64 = 'base64,';
+                this.content =
+                    this.fileContents.indexOf(base64) + base64.length;
                 this.fileContents = this.fileContents.substring(this.content);
-                console.log('getCsvFile')
+                console.log('getCsvFile');
                 this.importCSVFile();
             };
             this.fileReader.readAsDataURL(this.file);
         } else {
-            this.fileName = "閫夋嫨涓�涓猚sv鏂囦欢涓婁紶";
-            this.showMyToast('涓婁紶澶辫触', '閫夋嫨涓�涓猚sv鏂囦欢涓婁紶', 'Error')
+            this.fileName = '閫夋嫨涓�涓猚sv鏂囦欢涓婁紶';
+            this.showMyToast('涓婁紶澶辫触', '閫夋嫨涓�涓猚sv鏂囦欢涓婁紶', 'Error');
         }
     }
 
     importCSVFile() {
-        console.log('importCSVFile')
+        console.log('importCSVFile');
         console.log('this.sqlagencyProType = ' + this.sqlagencyProType);
         console.log('this.userWorkLocation = ' + this.userWorkLocation);
         console.log('this.accountName = ' + this.accountName);
-        console.log('encodeURIComponent(this.fileContents) = ' + encodeURIComponent(this.fileContents));
+        console.log(
+            'encodeURIComponent(this.fileContents) = ' +
+                encodeURIComponent(this.fileContents)
+        );
         importCSVFile({
             base64DataLwc: encodeURIComponent(this.fileContents),
             sqlagencyProTypeLwc: this.sqlagencyProType,
             userWorkLocationLwc: this.userWorkLocation,
-            accountNameLwc: this.accountName,
-        }).then((r) => {
-            r = JSON.parse(JSON.stringify(r));
-            console.log("r = " + JSON.stringify(r));
-            if (r.status == "Success" && r.msg == "") {
-                console.log("importCSVFile success");
-                this.saveFLGbln = r.entity.saveFLGbln;
-                this.csvRecordStr = r.entity.csvRecordStr;
-                this.secondAgencyMap = r.entity.secondAgencyMap;
-                this.hospitalSysMap = r.entity.hospitalSysMap;
-                this.data = r.entity.orderRecords;
-                for (var i in this.data) {
-                    this.data[i]['orderName'] = this.data[i].order.Name;
-                    this.data[i]['orderSummonsForDirction'] = this.data[i].order.SummonsForDirction__c;
-                    this.data[i]['orderOrderForCustomerText'] = this.data[i].order.Order_ForCustomerText__c;
-                    this.data[i]['orderOutboundDate'] = this.data[i].order.Outbound_Date__c;
+            accountNameLwc: this.accountName
+        })
+            .then((r) => {
+                r = JSON.parse(JSON.stringify(r));
+                console.log('r = ' + JSON.stringify(r));
+                if (r.status == 'Success' && r.msg == '') {
+                    console.log('importCSVFile success');
+                    this.saveFLGbln = r.entity.saveFLGbln;
+                    this.csvRecordStr = r.entity.csvRecordStr;
+                    this.secondAgencyMap = r.entity.secondAgencyMap;
+                    this.hospitalSysMap = r.entity.hospitalSysMap;
+                    this.data = r.entity.orderRecords;
+                    for (var i in this.data) {
+                        this.data[i]['orderName'] = this.data[i].order.Name;
+                        this.data[i]['orderSummonsForDirction'] =
+                            this.data[i].order.SummonsForDirction__c;
+                        this.data[i]['orderOrderForCustomerText'] =
+                            this.data[i].order.Order_ForCustomerText__c;
+                        this.data[i]['orderOutboundDate'] =
+                            this.data[i].order.Outbound_Date__c;
+                    }
+                    this.isShowSpinner = false;
+                } else if (r.msg != '') {
+                    console.log('r.msg = ' + JSON.stringify(r.msg));
+                    this.saveFLGbln = r.entity.saveFLGbln;
+                    this.data = r.entity.orderRecords;
+                    for (var i in this.data) {
+                        this.data[i]['orderName'] = this.data[i].order.Name;
+                        this.data[i]['orderSummonsForDirction'] =
+                            this.data[i].order.SummonsForDirction__c;
+                        this.data[i]['orderOrderForCustomerText'] =
+                            this.data[i].order.Order_ForCustomerText__c;
+                        this.data[i]['orderOutboundDate'] =
+                            this.data[i].order.Outbound_Date__c;
+                    }
+                    this.showMyToast('瀵煎叆澶辫触', r.msg, 'Error');
+                } else {
+                    console.log('r.msg = ' + JSON.stringify(r.msg));
+                    this.showMyToast('瀵煎叆澶辫触', r.msg, 'Error');
                 }
-                this.isShowSpinner = false;
-            } else if (r.msg != "") {
-                console.log("r.msg = " + JSON.stringify(r.msg));
-                this.saveFLGbln = r.entity.saveFLGbln;
-                this.data = r.entity.orderRecords;
-                for (var i in this.data) {
-                    this.data[i]['orderName'] = this.data[i].order.Name;
-                    this.data[i]['orderSummonsForDirction'] = this.data[i].order.SummonsForDirction__c;
-                    this.data[i]['orderOrderForCustomerText'] = this.data[i].order.Order_ForCustomerText__c;
-                    this.data[i]['orderOutboundDate'] = this.data[i].order.Outbound_Date__c;
-                }
-                this.showMyToast('瀵煎叆澶辫触', r.msg, 'Error')
-            } else {
-                console.log("r.msg = " + JSON.stringify(r.msg));
-                this.showMyToast('瀵煎叆澶辫触', r.msg, 'Error')
-            }
-        }).catch((error) => {
-            console.log("error = " + JSON.stringify(error.message));
-            this.showMyToast('瀵煎叆閿欒', '瀵煎叆澶辫触', 'Error')
-        });
+            })
+            .catch((error) => {
+                console.log('error = ' + JSON.stringify(error.message));
+                this.showMyToast('瀵煎叆閿欒', '瀵煎叆澶辫触', 'Error');
+            });
     }
 
     dataImport() {
@@ -229,29 +243,31 @@
             accountidLwc: this.accountid,
             agencyProTypeLwc: this.agencyProType,
             secondAgencyMapLwc: this.secondAgencyMap,
-            hospitalSysMapLwc: this.hospitalSysMap,
-        }).then((r) => {
-            r = JSON.parse(JSON.stringify(r));
-            console.log("r = " + JSON.stringify(r));
-            if (r.status == "Success" && r.msg == "") {
-                this.saveFLGbln = true;
-                console.log("dataImport success");
-                this.showMyToast('鎴愬姛', '淇濆瓨鎴愬姛', 'Success')
-            } else if (r.msg != "") {
-                console.log("r.msg = " + JSON.stringify(r.msg));
-                this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error')
-            } else {
-                console.log("r.msg = " + JSON.stringify(r.msg));
-                this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error')
-            }
-        }).catch((error) => {
-            console.log("error = " + JSON.stringify(error.message));
-            this.showMyToast('閿欒', '淇濆瓨澶辫触', 'Error')
-        });
+            hospitalSysMapLwc: this.hospitalSysMap
+        })
+            .then((r) => {
+                r = JSON.parse(JSON.stringify(r));
+                console.log('r = ' + JSON.stringify(r));
+                if (r.status == 'Success' && r.msg == '') {
+                    this.saveFLGbln = true;
+                    console.log('dataImport success');
+                    this.showMyToast('鎴愬姛', '淇濆瓨鎴愬姛', 'Success');
+                } else if (r.msg != '') {
+                    console.log('r.msg = ' + JSON.stringify(r.msg));
+                    this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error');
+                } else {
+                    console.log('r.msg = ' + JSON.stringify(r.msg));
+                    this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error');
+                }
+            })
+            .catch((error) => {
+                console.log('error = ' + JSON.stringify(error.message));
+                this.showMyToast('閿欒', '淇濆瓨澶辫触', 'Error');
+            });
     }
 
     handleFilesChange(event) {
-        console.log("handleFilesChange");
+        console.log('handleFilesChange');
         if (event.target.files.length > 0) {
             this.filesUploaded = event.target.files;
             this.fileName = event.target.files[0].name;
@@ -269,10 +285,17 @@
             iconName = 'utility:error';
         }
         if (message != '') {
-            content = '<h2><strong>' + title + '<strong/></h2><h5>' + message + '</h5>';
+            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);
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.9.1