From b5c5eb130ca0848124f9d136af4be142ad5aac07 Mon Sep 17 00:00:00 2001
From: binxie <137736985@qq.com>
Date: 星期一, 26 六月 2023 14:42:02 +0800
Subject: [PATCH] backup0626

---
 force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js |  213 ++++++++++++++++++++++------------------------------
 1 files changed, 91 insertions(+), 122 deletions(-)

diff --git a/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js
index 0281ae7..2cf3248 100644
--- a/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js
+++ b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js
@@ -1,15 +1,14 @@
-import { LightningElement, wire, api, track } from 'lwc';
+import { LightningElement,wire,api,track } from 'lwc';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import { NavigationMixin } from 'lightning/navigation';
 import initPage from '@salesforce/apex/LexConsumableOrderManageController.init1';
 import searchConsumableorderdetails from '@salesforce/apex/LexConsumableOrderManageController.searchConsumableorderdetails';
-//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 LexConsumableOrderManage extends NavigationMixin(
-    LightningElement
-) {
+
+export default class LexConsumableOrderManage extends NavigationMixin(LightningElement) {
     @track category1;
     @track orderDate;
     @track orderStatus = '';
@@ -29,12 +28,12 @@
     //鏄惁涓�鐩存樉绀烘彁绀�
     @track isNoteStay = true;
 
-    connectedCallback() {
+    connectedCallback(){
         this.showSpinner = true;
         initPage()
-            .then((result) => {
+            .then(result=>{
                 this.isNoteStay = result.isNoteStay;
-                if (result.result == 'Success') {
+                if(result.result == 'Success'){
                     this.provinceOpts = result.provinceOpts;
                     this.title = result.title;
                     this.raesList = result.raesList;
@@ -44,68 +43,64 @@
                     this.hasHop = result.hasHop;
                     this.hasSpecial = result.hasSpecial;
                     this.cols = result.cols;
-                    if (this.hasHop == true && this.agencyProType == 'ENG') {
+                    if(this.hasHop == true && this.agencyProType == 'ENG'){
                         this.showHop = true;
                     }
-                    for (var i in this.raesList) {
-                        if (this.raesList[i].Order_ForHospital__c) {
-                            this.raesList[i]['hosUrl'] =
-                                '/s/detail/' +
-                                this.raesList[i].Order_ForHospital__c;
-                            this.raesList[i]['hosName'] =
-                                this.raesList[i].Order_ForHospital__r.Name;
+                    for(var i in this.raesList){
+                        if(this.raesList[i].Order_ForHospital__c){
+                            this.raesList[i]['hosUrl'] = '/s/detail/'+this.raesList[i].Order_ForHospital__c;
+                            this.raesList[i]['hosName'] = this.raesList[i].Order_ForHospital__r.Name;
                         }
-                        this.raesList[i]['nameUrl'] =
-                            '/s/lexconsumable?ESetid=' + this.raesList[i].Id;
+                        this.raesList[i]['nameUrl'] = '/s/lexconsumable?ESetid='+this.raesList[i].Id;
                     }
                     this.showSpinner = false;
                     this.showPage = true;
-                } else {
+                }else{
                     this.showSpinner = false;
-                    console.log('Error:' + result.errorMsg);
+                    console.log("Error:"+result.errorMsg);
                     const evt = new ShowToastEvent({
-                        title: '鍒濆鍖栭〉闈㈠け璐�',
+                        title : '鍒濆鍖栭〉闈㈠け璐�',
                         message: result.errorMsg,
                         variant: 'error'
                     });
                     this.dispatchEvent(evt);
                 }
             })
-            .catch((error) => {
+            .catch(error=>{
                 this.showSpinner = false;
-                console.log('Error:' + error);
-            });
+                console.log("Error:"+error);
+            })
     }
 
-    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");
                 });
         }
     }
 
-    category1Change(event) {
+    category1Change(event){
         this.category1 = event.detail.value;
-        console.log('category1:' + this.category1);
+        console.log('category1:'+this.category1);
     }
-
-    orderDateChange(event) {
+    
+    orderDateChange(event){
         this.orderDate = event.detail.value;
-        console.log('orderDate:' + this.orderDate);
+        console.log('orderDate:'+this.orderDate);
     }
 
-    orderStatusChange(event) {
+    orderStatusChange(event){
         this.orderStatus = event.detail.value;
-        console.log('orderStatus:' + this.orderStatus);
+        console.log('orderStatus:'+this.orderStatus);
     }
 
-    agreementorder(event) {
+    agreementorder(event){
         const config = {
             type: 'standard__webPage',
             attributes: {
@@ -115,7 +110,7 @@
         this[NavigationMixin.Navigate](config);
     }
 
-    hospitalorder(event) {
+    hospitalorder(event){
         const config = {
             type: 'standard__webPage',
             attributes: {
@@ -125,7 +120,7 @@
         this[NavigationMixin.Navigate](config);
     }
 
-    promotionorder(event) {
+    promotionorder(event){
         const config = {
             type: 'standard__webPage',
             attributes: {
@@ -135,106 +130,80 @@
         this[NavigationMixin.Navigate](config);
     }
 
-    searchProduct(event) {
+    searchProduct(event){
         this.showSpinner = true;
-        searchConsumableorderdetails({
-            categoryStr: this.category1,
-            orderDate: this.orderDate,
-            orderStatus: this.orderStatus,
-            accountidStr: this.accountid,
-            agencyProTypeStr: this.agencyProType,
-            userWorkLocationStr: this.userWorkLocation
-        }).then((result) => {
-            if (result.result == 'Success') {
-                this.raesList = result.raesList;
-                for (var i in this.raesList) {
-                    if (this.raesList[i].Order_ForHospital__c) {
-                        this.raesList[i]['hosUrl'] =
-                            '/s/detail/' +
-                            this.raesList[i].Order_ForHospital__c;
-                        this.raesList[i]['hosName'] =
-                            this.raesList[i].Order_ForHospital__r.Name;
+        searchConsumableorderdetails({categoryStr:this.category1,orderDate:this.orderDate,orderStatus:this.orderStatus,accountidStr:this.accountid,agencyProTypeStr:this.agencyProType,userWorkLocationStr:this.userWorkLocation})
+            .then(result=>{
+                if(result.result == 'Success'){
+                    this.raesList = result.raesList;
+                    for(var i in this.raesList){
+                        if(this.raesList[i].Order_ForHospital__c){
+                            this.raesList[i]['hosUrl'] = '/s/detail/'+this.raesList[i].Order_ForHospital__c;
+                            this.raesList[i]['hosName'] = this.raesList[i].Order_ForHospital__r.Name;
+                        }
+                        this.raesList[i]['nameUrl'] = '/s/lexconsumable?ESetid='+this.raesList[i].Id;
                     }
-                    this.raesList[i]['nameUrl'] =
-                        '/s/lexconsumable?ESetid=' + this.raesList[i].Id;
+                    this.showSpinner = false;
+                    this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+                }else{
+                    this.showSpinner = false;
+                    this.raesList = result.raesList;
+                    console.log("Error:"+result.errorMsg);
+                    if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏宠鍗�'){
+                        this.showMyToast(result.errorMsg,'','error');
+                    }else{
+                        this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+                    }
+                    this.dispatchEvent(evt);
                 }
-                this.showSpinner = false;
-                this.showMyToast('鎼滅储鎴愬姛', result.errorMsg, 'success');
-            } else {
-                this.showSpinner = false;
-                this.raesList = result.raesList;
-                console.log('Error:' + result.errorMsg);
-                if (result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏宠鍗�') {
-                    this.showMyToast(result.errorMsg, '', 'error');
-                } else {
-                    this.showMyToast('鎼滅储澶辫触', result.errorMsg, 'error');
-                }
-                this.dispatchEvent(evt);
-            }
-        });
+            })
     }
 
-    clear(event) {
+    clear(event){
         this.category1 = '';
         this.orderDate = null;
         this.orderStatus = '';
-        searchConsumableorderdetails({
-            categoryStr: this.category1,
-            orderDate: this.orderDate,
-            orderStatus: this.orderStatus,
-            accountidStr: this.accountid,
-            agencyProTypeStr: this.agencyProType,
-            userWorkLocationStr: this.userWorkLocation
-        }).then((result) => {
-            if (result.result == 'Success') {
-                this.raesList = result.raesList;
-                for (var i in this.raesList) {
-                    if (this.raesList[i].Order_ForHospital__c) {
-                        this.raesList[i]['hosUrl'] =
-                            '/s/detail/' +
-                            this.raesList[i].Order_ForHospital__c;
-                        this.raesList[i]['hosName'] =
-                            this.raesList[i].Order_ForHospital__r.Name;
+        searchConsumableorderdetails({categoryStr:this.category1,orderDate:this.orderDate,orderStatus:this.orderStatus,accountidStr:this.accountid,agencyProTypeStr:this.agencyProType,userWorkLocationStr:this.userWorkLocation})
+            .then(result=>{
+                if(result.result == 'Success'){
+                    this.raesList = result.raesList;
+                    for(var i in this.raesList){
+                        if(this.raesList[i].Order_ForHospital__c){
+                            this.raesList[i]['hosUrl'] = '/s/detail/'+this.raesList[i].Order_ForHospital__c;
+                            this.raesList[i]['hosName'] = this.raesList[i].Order_ForHospital__r.Name;
+                        }
+                        this.raesList[i]['nameUrl'] = '/s/lexconsumable?ESetid='+this.raesList[i].Id;
                     }
-                    this.raesList[i]['nameUrl'] =
-                        '/s/lexconsumable?ESetid=' + this.raesList[i].Id;
+                    this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+                }else{
+                    this.raesList = result.raesList;
+                    console.log("Error:"+result.errorMsg);
+                    if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏宠鍗�'){
+                        this.showMyToast(result.errorMsg,'','error');
+                    }else{
+                        this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+                    }
+                    this.dispatchEvent(evt);
                 }
-                this.showMyToast('鎼滅储鎴愬姛', result.errorMsg, 'success');
-            } else {
-                this.raesList = result.raesList;
-                console.log('Error:' + result.errorMsg);
-                if (result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏宠鍗�') {
-                    this.showMyToast(result.errorMsg, '', 'error');
-                } else {
-                    this.showMyToast('鎼滅储澶辫触', result.errorMsg, 'error');
-                }
-                this.dispatchEvent(evt);
-            }
-        });
+            })
     }
 
     showMyToast(title, message, variant) {
         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';
@@ -248,5 +217,5 @@
         //     mode: mode
         // });
         // this.dispatchEvent(evt);
-    }
+     }
 }
\ No newline at end of file

--
Gitblit v1.9.1